forked from sorin-ionescu/prezto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added conda virtualenv support to python module. (sorin-ionescu#1505)
* Added conda virtualenv support to python module * Added instructions for Python module options to README Thanks to @egpbos for the original feature and @ickc for fixing the merge conflicts.
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# | ||
# Authors: | ||
# Sorin Ionescu <[email protected]> | ||
# Patrick Bos <[email protected]> | ||
# | ||
|
||
# function python-info { | ||
|
@@ -22,4 +23,11 @@ if [[ -n "$VIRTUAL_ENV" ]]; then | |
python_info[virtualenv]="$virtualenv_formatted" | ||
fi | ||
|
||
# Do the same for Conda virtual environments | ||
if [[ -n "$CONDA_DEFAULT_ENV" ]]; then | ||
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format' | ||
zformat -f virtualenv_formatted "$virtualenv_format" "v:${CONDA_DEFAULT_ENV:t}" | ||
python_info[virtualenv]="$virtualenv_formatted" | ||
fi | ||
|
||
# } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# Authors: | ||
# Sorin Ionescu <[email protected]> | ||
# Sebastian Wiesner <[email protected]> | ||
# Patrick Bos <[email protected]> | ||
# | ||
|
||
# Load manually installed pyenv into the shell session. | ||
|
@@ -144,6 +145,19 @@ if (( $#commands[(i)pip(|[23])] )); then | |
unset cache_file pip_command | ||
fi | ||
|
||
# Load conda into the shell session, if requested | ||
zstyle -T ':prezto:module:python' conda-init | ||
if (( $? && $+commands[conda] )); then | ||
if (( $(conda ..changeps1) )); then | ||
echo "To make sure Conda doesn't change your prompt (should do that in the prompt module) run:\n conda config --set changeps1 false" | ||
# TODO: | ||
# We could just run this ourselves. In an exit hook | ||
# (add zsh-hook zshexit [(anonymous) function]) we could then set it back | ||
# to the way it was before we changed it. However, I'm not sure if this is | ||
# exception safe, so left it like this for now. | ||
fi | ||
fi | ||
|
||
# | ||
# Aliases | ||
# | ||
|