From 113f290826852a6bf5c38f3e2d6d38a22aa261cc Mon Sep 17 00:00:00 2001 From: romkatv Date: Mon, 2 Dec 2019 13:29:58 +0100 Subject: [PATCH] add vim_shell prompt segment; see #359 --- config/p10k-classic.zsh | 7 +++++++ config/p10k-lean.zsh | 7 +++++++ config/p10k-rainbow.zsh | 8 ++++++++ internal/icons.zsh | 5 +++++ internal/p10k.zsh | 11 ++++++++++- 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 6192d6fe..90d5f808 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -69,6 +69,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + vim_shell # vim shell indicator (:sh) # midnight_commander # midnight commander shell (https://midnight-commander.org/) vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator @@ -519,6 +520,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### + # Vim shell indicator color. + typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 + # Custom icon. + # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 670036a6..454c6f9d 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -69,6 +69,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + vim_shell # vim shell indicator (:sh) # midnight_commander # midnight commander shell (https://midnight-commander.org/) # vpn_ip # virtual private network indicator # ram # free RAM @@ -512,6 +513,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### + # Vim shell indicator color. + typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 + # Custom icon. + # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index fb67b660..90a19b39 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -69,6 +69,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + vim_shell # vim shell indicator (:sh) # midnight_commander # midnight commander shell (https://midnight-commander.org/) vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator @@ -518,6 +519,13 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### + # Vim shell indicator color. + # typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 + # typeset -g POWERLEVEL9K_VIM_SHELL_BACKGROUND=2 + # Custom icon. + # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 diff --git a/internal/icons.zsh b/internal/icons.zsh index 17d6341b..abfc4b3d 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -112,6 +112,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ MIDNIGHT_COMMANDER_ICON 'mc' + VIM_ICON 'vim' TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ PROXY_ICON '\u2B82' # ⮂ DOTNET_ICON '.NET' @@ -216,6 +217,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ MIDNIGHT_COMMANDER_ICON 'mc' + VIM_ICON 'vim' TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ PROXY_ICON '\u2B82' # ⮂ DOTNET_ICON '.NET' @@ -324,6 +326,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ MIDNIGHT_COMMANDER_ICON 'mc' + VIM_ICON 'vim' TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ PROXY_ICON '\u2B82' # ⮂ DOTNET_ICON '.NET' @@ -429,6 +432,7 @@ function _p9k_init_icons() { LARAVEL_ICON '\ue73f' #  RANGER_ICON '\u2B50' # ⭐ MIDNIGHT_COMMANDER_ICON 'mc' + VIM_ICON '\uE62B' #  TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ PROXY_ICON '\u2B82' # ⮂ DOTNET_ICON '\uE77F' #  @@ -533,6 +537,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ MIDNIGHT_COMMANDER_ICON 'mc' + VIM_ICON 'vim' TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ PROXY_ICON '\u2194' # ↔ DOTNET_ICON '.NET' diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 1e3e1e7d..83f55ecf 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3455,6 +3455,15 @@ function instant_prompt_midnight_commander() { _p9k_prompt_segment prompt_midnight_commander $_p9k_color1 yellow MIDNIGHT_COMMANDER_ICON 0 '$MC_TMPDIR' '' } +function prompt_vim_shell() { + [[ -n $VIMRUNTIME ]] || return + _p9k_prompt_segment $0 green $_p9k_color1 VIM_ICON 0 '' '' +} + +function instant_prompt_vim_shell() { + _p9k_prompt_segment prompt_vim_shell green $_p9k_color1 VIM_ICON 0 '$VIMRUNTIME' '' +} + function prompt_terraform() { (( $+commands[terraform] )) || return local ws=default @@ -5376,7 +5385,7 @@ _p9k_must_init() { [[ $sig == $_p9k__param_sig ]] && return 1 _p9k_deinit fi - _p9k__param_pat=$'v12\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' + _p9k__param_pat=$'v13\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1' _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'