Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conda support. #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion git-prompt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# hg_module=on
# vim_module=on
# virtualenv_module=on

# conda_module=on

########################################################### DEFAULT OBJECTS
### Default objects are not displayed. Example:
Expand Down Expand Up @@ -55,6 +55,7 @@
# dir_color=CYAN
# rc_color=red
# virtualenv_color=green
# conda_color=yellow
# user_id_color=blue
# root_id_color=magenta
# else # B/W terminal
Expand Down
14 changes: 13 additions & 1 deletion git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
hg_module=${hg_module:-on}
vim_module=${vim_module:-on}
virtualenv_module=${virtualenv_module:-on}
conda_module=${conda_module:-on}
error_bell=${error_bell:-off}
cwd_cmd=${cwd_cmd:-\\w}

Expand All @@ -44,6 +45,7 @@
dir_color=${dir_color:-CYAN}
rc_color=${rc_color:-red}
virtualenv_color=${virtualenv_color:-green}
conda_color=${conda_color:-yellow}
user_id_color=${user_id_color:-blue}
root_id_color=${root_id_color:-magenta}
else # only B/W
Expand Down Expand Up @@ -290,6 +292,7 @@ set_shell_label() {
dir_color=${!dir_color}
rc_color=${!rc_color}
virtualenv_color=${!virtualenv_color}
conda_color=${!conda_color}
user_id_color=${!user_id_color}
root_id_color=${!root_id_color}

Expand Down Expand Up @@ -647,10 +650,18 @@ parse_virtualenv_status() {

if [[ -n "$VIRTUAL_ENV" ]] ; then
virtualenv=`basename $VIRTUAL_ENV`
rc="$rc $virtualenv_color<$virtualenv> "
rc="$rc$virtualenv_color<$virtualenv> "
fi
}

parse_conda_status() {
[[ $virtualenv_module = "on" ]] || return 1

if [[ -n "$CONDA_DEFAULT_ENV" ]] ; then
rc="$rc$conda_color[$CONDA_DEFAULT_ENV] "
fi
}

disable_set_shell_label() {
trap - DEBUG >& /dev/null
}
Expand Down Expand Up @@ -702,6 +713,7 @@ prompt_command_function() {
set_shell_label "${cwd##[/~]*/}/" # default label - path last dir

parse_virtualenv_status
parse_conda_status
parse_vcs_status

# autojump
Expand Down
4 changes: 3 additions & 1 deletion index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ GIT. Enable if needed in <<config,config>>
== Mercurial/HG
HG module was developed by Lee Nussbaum `<wln AT scrunch.org>`.

== Conda
The Conda module was developed by Lev Givon `<lev AT columbia.edu>`.

== Labels

Expand Down Expand Up @@ -200,7 +202,7 @@ time consuming ops in postconfig which is executed only once.
- Dan Bravender <dan.bravender AT gmail.com>
- Thomas Geffert <thomas.geffert AT arcutronix.com>
- Tibor Simko <tibor.simko AT cern.ch>

- Lev Givon <lev AT columbia.edu>

[bibliography]
.References
Expand Down