mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] display current Python virtualenv in the prompt
This commit is contained in:
parent
3e499704a0
commit
cf9f46a90e
1 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
export VIRTUAL_ENV_DISABLE_PROMPT=false
|
||||||
|
|
||||||
# Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so
|
# Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so
|
||||||
# that untrusted input (e.g. git branch names) doesn't affect prompt rendering.
|
# that untrusted input (e.g. git branch names) doesn't affect prompt rendering.
|
||||||
prompt_escape() {
|
prompt_escape() {
|
||||||
|
@ -51,7 +53,7 @@ prompt_vcs_info() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%F{blue}%f'
|
print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%f'
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure prompt expansion
|
# configure prompt expansion
|
||||||
|
@ -98,6 +100,9 @@ PROMPT+=' in %F{cyan}%~%f'
|
||||||
# VCS info
|
# VCS info
|
||||||
PROMPT+='$(prompt_vcs_info 2>/dev/null)'
|
PROMPT+='$(prompt_vcs_info 2>/dev/null)'
|
||||||
|
|
||||||
|
# Python's virtualenv
|
||||||
|
PROMPT+='${VIRTUAL_ENV:+" %F{blue}venv:%F{magenta}${VIRTUAL_ENV:t}%f"}'
|
||||||
|
|
||||||
PROMPT+=' '
|
PROMPT+=' '
|
||||||
|
|
||||||
# command execution time
|
# command execution time
|
||||||
|
|
Loading…
Reference in a new issue