Bash: Virtualenv stuff.
This commit is contained in:
parent
ec8b4ace1c
commit
e16b0b1397
@ -99,6 +99,10 @@ alias gw="grunt watch --debug"
|
|||||||
alias gs="grunt connect watch --debug"
|
alias gs="grunt connect watch --debug"
|
||||||
gi() { grunt-init $@; }
|
gi() { grunt-init $@; }
|
||||||
|
|
||||||
|
# Virtualenv
|
||||||
|
alias venv='test -d ENV && source ./ENV/bin/activate || echo "No Virtualenv in the current folder."'
|
||||||
|
alias venv-init='test -d ENV && echo "Virtualenv already exists." || virtualenv --no-site-packages ENV; venv'
|
||||||
|
|
||||||
# Magic Project Opener
|
# Magic Project Opener
|
||||||
function proj { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w project $2)"; }
|
function proj { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w project $2)"; }
|
||||||
function repo { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w repo $2)"; }
|
function repo { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w repo $2)"; }
|
||||||
|
@ -20,6 +20,7 @@ esac
|
|||||||
prompt_symbol="❯"
|
prompt_symbol="❯"
|
||||||
prompt_clean_symbol="☀ "
|
prompt_clean_symbol="☀ "
|
||||||
prompt_dirty_symbol="☂ "
|
prompt_dirty_symbol="☂ "
|
||||||
|
prompt_venv_symbol="☁ "
|
||||||
|
|
||||||
function prompt_command() {
|
function prompt_command() {
|
||||||
# Local or SSH session?
|
# Local or SSH session?
|
||||||
@ -48,6 +49,12 @@ function prompt_command() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Virtualenv
|
||||||
|
local venv_prompt=
|
||||||
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
|
venv_prompt=" $BLUE$prompt_venv_symbol$(basename $VIRTUAL_ENV)$NOCOLOR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Only show username if not default
|
# Only show username if not default
|
||||||
local user_prompt=
|
local user_prompt=
|
||||||
[ "$USER" != "$local_username" ] && user_prompt="$user_color$USER$NOCOLOR"
|
[ "$USER" != "$local_username" ] && user_prompt="$user_color$USER$NOCOLOR"
|
||||||
@ -61,7 +68,7 @@ function prompt_command() {
|
|||||||
[ -n "$user_prompt" ] || [ -n "$host_prompt" ] && login_delimiter=":"
|
[ -n "$user_prompt" ] || [ -n "$host_prompt" ] && login_delimiter=":"
|
||||||
|
|
||||||
# Format prompt
|
# Format prompt
|
||||||
first_line="$user_prompt$host_prompt$login_delimiter$WHITE\w$NOCOLOR$git_prompt"
|
first_line="$user_prompt$host_prompt$login_delimiter$WHITE\w$NOCOLOR$git_prompt$venv_prompt"
|
||||||
# Text (commands) inside \[...\] does not impact line length calculation which fixes stange bug when looking through the history
|
# Text (commands) inside \[...\] does not impact line length calculation which fixes stange bug when looking through the history
|
||||||
# $? is a status of last command, should be processed every time prompt prints
|
# $? is a status of last command, should be processed every time prompt prints
|
||||||
second_line="\`if [ \$? = 0 ]; then echo \[\$CYAN\]; else echo \[\$RED\]; fi\`\$prompt_symbol\[\$NOCOLOR\] "
|
second_line="\`if [ \$? = 0 ]; then echo \[\$CYAN\]; else echo \[\$RED\]; fi\`\$prompt_symbol\[\$NOCOLOR\] "
|
||||||
|
Loading…
Reference in New Issue
Block a user