From aeb08aea3fb2673a9ec004f29af7be012a963bb6 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 5 Apr 2014 09:14:55 -0500 Subject: [PATCH 1/4] Update powerline to show conda environments --- themes/powerline/powerline.theme.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 81598dec..012f9333 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -53,9 +53,16 @@ function powerline_shell_prompt { } function powerline_virtualenv_prompt { - if [[ -n "$VIRTUAL_ENV" ]]; then - virtualenv=$(basename "$VIRTUAL_ENV") - VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$virtualenv ${normal}" + local environ="" + + if [[ -n "$CONDA_DEFAULT_ENV" ]]; then + environ="conda: $CONDA_DEFAULT_ENV" + elif [[ -n "$VIRTUAL_ENV" ]]; then + environ=$(basename "$VIRTUAL_ENV") + fi + + if [[ -n "$environ" ]]; then + VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$environ ${normal}" LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR} else VIRTUALENV_PROMPT="" From 8f0d0421fc6e5f0446f1f8f82ed4fd59c96ac7bc Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sat, 5 Apr 2014 09:17:59 -0500 Subject: [PATCH 2/4] Add in conda tab-completion --- completion/available/conda.completion.bash | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 completion/available/conda.completion.bash diff --git a/completion/available/conda.completion.bash b/completion/available/conda.completion.bash new file mode 100644 index 00000000..cb5a15da --- /dev/null +++ b/completion/available/conda.completion.bash @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +which register-python-argcomplete > /dev/null \ + && eval "$(register-python-argcomplete conda)" \ + || echo "Please install argcomplete to use conda completion" From 10bda0c11123cc2be8b4383a717052363dd6273e Mon Sep 17 00:00:00 2001 From: "John A. Barbuto" Date: Sat, 5 Apr 2014 15:28:27 -0700 Subject: [PATCH 3/4] Use relative symlinks during installation When using dotfiles synced between different machines, this allows enabled aliases, completions, and plugins to work with varying home directories. --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 46edcf22..4c0bf081 100755 --- a/install.sh +++ b/install.sh @@ -36,7 +36,7 @@ function load_all() { [ ${filename:0:1} = "_" ] && continue dest="${BASH_IT}/${file_type}/enabled/${filename}" if [ ! -e "${dest}" ]; then - ln -s "${src}" "${dest}" + ln -s "../available/${filename}" "${dest}" else echo "File ${dest} exists, skipping" fi @@ -57,7 +57,7 @@ function load_some() { read -p "Would you like to enable the ${file_name%%.*} $file_type? [Y/N] " RESP case $RESP in [yY]) - ln -s "$path" "$BASH_IT/$file_type/enabled" + ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled" break ;; [nN]) From fb134f4e3b8a0b6a5c980f1cdf02ec845c1d0d78 Mon Sep 17 00:00:00 2001 From: "John A. Barbuto" Date: Sun, 6 Apr 2014 13:27:16 -0700 Subject: [PATCH 4/4] Use relative symlinks for enabling plugins This extends 10bda0c for post-install enablements as well. --- lib/helpers.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index b99ae3d3..4c39704d 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -261,7 +261,7 @@ _enable-thing () do plugin=$(basename $f) if [ ! -h $BASH_IT/$subdirectory/enabled/$plugin ]; then - ln -s $BASH_IT/$subdirectory/available/$plugin $BASH_IT/$subdirectory/enabled/$plugin + ln -s ../available/$plugin $BASH_IT/$subdirectory/enabled/$plugin fi done else @@ -279,7 +279,7 @@ _enable-thing () mkdir -p $BASH_IT/$subdirectory/enabled - ln -s $BASH_IT/$subdirectory/available/$plugin $BASH_IT/$subdirectory/enabled/$plugin + ln -s ../available/$plugin $BASH_IT/$subdirectory/enabled/$plugin fi printf '%s\n' "$file_entity enabled."