justinmayer/virtualfish

Semi-automatic activation

Evpok opened this issue · 6 comments

Evpok commented
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.
  • I am willing to lend a hand to help implement this feature.

Feature Request

I really like the idea of linking directories to envs, but at the same time I don't always want to activate the linked env when I cd into a dir. It would be nice if there was way to manually activate the environment linked to by vf connect even with auto_activation disabled. This could take the form of a dedicated command, or just the behaviour of vf activate without specifying an env (look into VIRTUALFISH_ACTIVATION_FILE and activate the env you find there`.

Hi @Evpok. Environments shouldn't be automatically activated via cd if automatic activation is disabled. I don't have time to parse and understand what you mean, so it's important when filing issues to be really specific and unequivocally clear. With that in mind, can you elaborate?

Evpok commented

Hi @justinmayer, let me try to reformulate: I wish to have links between directories and environments without using automatic activation, which is currently not supported. The behaviour I am looking for is for vf activate to look for a .venv (or whatever vf connect creates) file in the current directory, and if there is one, to activate the corresponding environment.

So, to summarize, you want to save a few keystrokes by typing vf activate instead of vf activate (cat .venv). Do I have that right?

Evpok commented

More like vf activate (cat $VIRTUALFISH_ACTIVATION_FILE) but yes, that's the idea.

My suggestion would be to define an abbreviation, replacing vfa with your desired short-cut/macro:

abbr -a vfa vf activate (cat $VIRTUALFISH_ACTIVATION_FILE)

That way you get what you want in three keystrokes.

But if you want to submit a pull request that activates the relevant virtual environment when vf activate is invoked with no arguments and a $VIRTUALFISH_ACTIVATION_FILE is present in the current working directory, I can't think of any obvious impediments to merging it.

Thoughts?

Evpok commented

Right, I'll do both: start with the abbreviation and see if I can get a PR to work. Thanks!