From acb6b68a37213a4362b1b27f3c2ca14ad2adb86e Mon Sep 17 00:00:00 2001 From: romkatv Date: Thu, 2 Jan 2020 18:59:19 +0100 Subject: [PATCH] add nnn prompt segment; see #342 --- config/p10k-classic.zsh | 7 +++++++ config/p10k-lean.zsh | 7 +++++++ config/p10k-rainbow.zsh | 8 ++++++++ internal/icons.zsh | 5 +++++ internal/p10k.zsh | 9 +++++++++ 5 files changed, 36 insertions(+) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 7d166a89..d0f8a3f4 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -75,6 +75,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + nnn # nnn shell (https://github.com/jarun/nnn) 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) @@ -530,6 +531,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### + # Nnn shell color. + typeset -g POWERLEVEL9K_NNN_FOREGROUND=72 + # Custom icon. + # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 57cb4ef4..e47d719a 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -75,6 +75,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + nnn # nnn shell (https://github.com/jarun/nnn) vim_shell # vim shell indicator (:sh) # midnight_commander # midnight commander shell (https://midnight-commander.org/) # vpn_ip # virtual private network indicator @@ -523,6 +524,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### + # Nnn shell color. + typeset -g POWERLEVEL9K_NNN_FOREGROUND=72 + # Custom icon. + # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index bfdc45d4..df10d293 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -75,6 +75,7 @@ context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) + nnn # nnn shell (https://github.com/jarun/nnn) 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) @@ -529,6 +530,13 @@ # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### + # Nnn shell color. + # typeset -g POWERLEVEL9K_NNN_FOREGROUND=0 + # typeset -g POWERLEVEL9K_NNN_BACKGROUND=6 + # Custom icon. + # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. # typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 diff --git a/internal/icons.zsh b/internal/icons.zsh index 3f240fe0..e16152fd 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -122,6 +122,7 @@ function _p9k_init_icons() { GCLOUD_ICON 'G' LUA_ICON 'lua' PERL_ICON 'perl' + NNN_ICON 'nnn' ) ;; 'awesome-fontconfig') @@ -231,6 +232,7 @@ function _p9k_init_icons() { GCLOUD_ICON 'G' LUA_ICON 'lua' PERL_ICON 'perl' + NNN_ICON 'nnn' ) ;; 'awesome-mapped-fontconfig') @@ -344,6 +346,7 @@ function _p9k_init_icons() { GCLOUD_ICON 'G' LUA_ICON 'lua' PERL_ICON 'perl' + NNN_ICON 'nnn' ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -454,6 +457,7 @@ function _p9k_init_icons() { GCLOUD_ICON '\uF7B7' #  LUA_ICON '\uE620' #  PERL_ICON '\uE769' #  + NNN_ICON 'nnn' ) ;; *) @@ -563,6 +567,7 @@ function _p9k_init_icons() { GCLOUD_ICON 'G' LUA_ICON 'lua' PERL_ICON 'perl' + NNN_ICON 'nnn' ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 08174e98..53ad4796 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3678,6 +3678,15 @@ function instant_prompt_midnight_commander() { _p9k_prompt_segment prompt_midnight_commander $_p9k_color1 yellow MIDNIGHT_COMMANDER_ICON 0 '$MC_TMPDIR' '' } +function prompt_nnn() { + [[ $NNNLVL == (0|) ]] && return + _p9k_prompt_segment $0 6 $_p9k_color1 NNN_ICON 0 '' $NNNLVL +} + +function instant_prompt_nnn() { + _p9k_prompt_segment prompt_nnn 6 $_p9k_color1 NNN_ICON 1 '${NNNLVL:#0}' '$NNNLVL' +} + function prompt_vim_shell() { [[ -n $VIMRUNTIME ]] || return _p9k_prompt_segment $0 green $_p9k_color1 VIM_ICON 0 '' ''