Created
April 10, 2020 17:28
-
-
Save gidgid/2a2e5952e4d6c02c4c1c02398d046027 to your computer and use it in GitHub Desktop.
Activating virtual envs with FZF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vf() { | |
# note that you need to extract the absolute path in order to get this to work | |
ls -d ~/.virtualenv/*/ | fzf | while read file; do source $file/bin/activate; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used find and null termination to avoid ls breaking on paths that contain spaces.
source "$(find ~/.virtualenvs/ -maxdepth 1 -type d -print0 | fzf --read0)"/bin/activate