add direnv segment; fixes 291

This commit is contained in:
romkatv 2019-10-27 11:27:03 +01:00
parent 6096321f61
commit f722f3d1ce
5 changed files with 37 additions and 4 deletions

View file

@ -44,6 +44,7 @@
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv)
@ -490,6 +491,12 @@
# Icon to show when there are background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
#######################[ direnv: direnv status (https://direnv.net/) ]########################
# Direnv color.
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178
# Icon to show when direnv is active.
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color.
typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39

View file

@ -44,6 +44,7 @@
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv)
@ -470,6 +471,12 @@
# Icon to show when there are background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⇶'
#######################[ direnv: direnv status (https://direnv.net/) ]########################
# Direnv color.
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178
# Icon to show when direnv is active.
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color.
typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39

View file

@ -44,6 +44,7 @@
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv)
@ -486,6 +487,13 @@
# Icon to show when there are background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
#######################[ direnv: direnv status (https://direnv.net/) ]########################
# Direnv color.
# typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=3
# typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=0
# Icon to show when direnv is active.
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color.
# typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=7

View file

@ -115,6 +115,7 @@ function _p9k_init_icons() {
PROXY_ICON '\u2B82' # ⮂
DOTNET_ICON '.NET'
AZURE_ICON '\u2601' # ☁
DIRENV_ICON '\u25BC' # ▼
)
;;
'awesome-fontconfig')
@ -217,6 +218,7 @@ function _p9k_init_icons() {
PROXY_ICON '\u2B82' # ⮂
DOTNET_ICON '.NET'
AZURE_ICON '\u2601' # ☁
DIRENV_ICON '\u25BC' # ▼
)
;;
'awesome-mapped-fontconfig')
@ -323,6 +325,7 @@ function _p9k_init_icons() {
PROXY_ICON '\u2B82' # ⮂
DOTNET_ICON '.NET'
AZURE_ICON '\u2601' # ☁
DIRENV_ICON '\u25BC' # ▼
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
@ -426,6 +429,7 @@ function _p9k_init_icons() {
PROXY_ICON '\u2B82' # ⮂
DOTNET_ICON '\uE77F' # 
AZURE_ICON '\uFD03' # ﴃ
DIRENV_ICON '\u25BC' # ▼
)
;;
*)
@ -446,7 +450,7 @@ function _p9k_init_icons() {
AWS_EB_ICON '\U1F331' # 🌱
BACKGROUND_JOBS_ICON '\u2699' # ⚙
TEST_ICON ''
TODO_ICON '\u2611' # ☑ (portable alternatives: ∆)
TODO_ICON '\u2611' # ☑ (portable alternative: ∆)
BATTERY_ICON '\U1F50B' # 🔋
DISK_ICON 'hdd'
OK_ICON '\u2714' # ✔
@ -525,9 +529,10 @@ function _p9k_init_icons() {
LARAVEL_ICON ''
RANGER_ICON '\u2B50' # ⭐
TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️
PROXY_ICON '\u2B82' # ⮂
PROXY_ICON '\u2194' # ↔
DOTNET_ICON '.NET'
AZURE_ICON '\u2601' # ☁
DIRENV_ICON '\u25BC' # ▼
)
;;
esac

View file

@ -3347,6 +3347,12 @@ function prompt_proxy() {
_p9k_prompt_segment $0 $_p9k_color1 blue PROXY_ICON 0 '' "$p[1]"
}
function prompt_direnv() {
_p9k_prompt_segment $0 $_p9k_color1 yellow DIRENV_ICON 0 '$DIRENV_DIR' ''
}
function instant_prompt_direnv() { prompt_direnv; }
_p9k_preexec() {
if (( $+_p9k_real_zle_rprompt_indent )); then
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then