fix chezmoi segment and rename it to chezmoi_shell (#2311)

- Link to the project's homepage rather than its source code.
- Move `chezmoi_shell` next to all the other *shell indicator* segments.
- Use a shade of blue that resembes the color on chezmoi.io.
- Don't go beyond 8 colors in 8-color configs.
- Remove the segment from the *pure* config.
- Fix whitespace padding on `CHEZMOI_ICON`.
- Use the appropriate icon with all fonts (the same as `HOME`).
- Add missing `CHEZMOI_ICON` definitions for "powerline" and "ascii" font modes.
- Remove the redundant literal "chezmoi" content from the segment.
- Fix instant prompt so that the segment is shown only when `$CHEZMOI` is non-empty.
pull/2344/head
Roman Perepelitsa 2 years ago
parent c775a3ffd5
commit cc4878aef2

@ -314,7 +314,7 @@ enable as many segments as you like. It won't slow down your prompt or Zsh start
| `azure` | [azure](https://docs.microsoft.com/en-us/cli/azure) account name | | `azure` | [azure](https://docs.microsoft.com/en-us/cli/azure) account name |
| `background_jobs` | presence of background jobs | | `background_jobs` | presence of background jobs |
| `battery` | internal battery state and charge level (yep, batteries *literally* included) | | `battery` | internal battery state and charge level (yep, batteries *literally* included) |
| `chezmoi` | [chezmoi](https://github.com/twpayne/chezmoi) shell | | `chezmoi_shell` | [chezmoi](https://www.chezmoi.io/) shell |
| `command_execution_time` | duration (wall time) of the last command | | `command_execution_time` | duration (wall time) of the last command |
| `context` | user@hostname | | `context` | user@hostname |
| `cpu_arch` | CPU architecture | | `cpu_arch` | CPU architecture |

@ -42,7 +42,6 @@
status # exit code of the last command status # exit code of the last command
command_execution_time # duration of the last command command_execution_time # duration of the last command
background_jobs # presence of background jobs background_jobs # presence of background jobs
chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi)
direnv # direnv status (https://direnv.net/) direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf) asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
@ -88,6 +87,7 @@
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
# vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
@ -740,12 +740,6 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi: chezmoi shell (https://github.com/twpayne/chezmoi) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_FOREGROUND=72
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########################[ vim_shell: vim shell indicator (:sh) ]########################### ###########################[ vim_shell: vim shell indicator (:sh) ]###########################
# Vim shell indicator color. # Vim shell indicator color.
typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34
@ -771,6 +765,12 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=33
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usage: disk usage ]################################## ##################################[ disk_usage: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35

@ -42,7 +42,6 @@
status # exit code of the last command status # exit code of the last command
command_execution_time # duration of the last command command_execution_time # duration of the last command
background_jobs # presence of background jobs background_jobs # presence of background jobs
chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi)
direnv # direnv status (https://direnv.net/) direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf) asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
@ -88,6 +87,7 @@
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
# disk_usage # disk usage # disk_usage # disk usage
@ -735,12 +735,6 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi: chezmoi shell (https://github.com/twpayne/chezmoi) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_FOREGROUND=72
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########################[ vim_shell: vim shell indicator (:sh) ]########################### ###########################[ vim_shell: vim shell indicator (:sh) ]###########################
# Vim shell indicator color. # Vim shell indicator color.
typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=3 typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=3
@ -766,6 +760,12 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=4
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usage: disk usage ]################################## ##################################[ disk_usage: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2

@ -42,7 +42,6 @@
status # exit code of the last command status # exit code of the last command
command_execution_time # duration of the last command command_execution_time # duration of the last command
background_jobs # presence of background jobs background_jobs # presence of background jobs
chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi)
direnv # direnv status (https://direnv.net/) direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf) asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
@ -88,6 +87,7 @@
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
# disk_usage # disk usage # disk_usage # disk usage
@ -731,12 +731,6 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi: chezmoi shell (https://github.com/twpayne/chezmoi) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_FOREGROUND=72
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########################[ vim_shell: vim shell indicator (:sh) ]########################### ###########################[ vim_shell: vim shell indicator (:sh) ]###########################
# Vim shell indicator color. # Vim shell indicator color.
typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34
@ -762,6 +756,12 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=33
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usage: disk usage ]################################## ##################################[ disk_usage: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35

@ -51,7 +51,6 @@
newline # \n newline # \n
virtualenv # python virtual environment virtualenv # python virtual environment
prompt_char # prompt symbol prompt_char # prompt symbol
chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi)
) )
# Right prompt segments. # Right prompt segments.

@ -45,7 +45,6 @@
direnv # direnv status (https://direnv.net/) direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf) asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi)
anaconda # conda environment (https://conda.io/) anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv) pyenv # python environment (https://github.com/pyenv/pyenv)
goenv # go environment (https://github.com/syndbg/goenv) goenv # go environment (https://github.com/syndbg/goenv)
@ -88,6 +87,7 @@
vim_shell # vim shell indicator (:sh) vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/) midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
# vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator # vpn_ip # virtual private network indicator
# load # CPU load # load # CPU load
@ -762,13 +762,6 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi: chezmoi shell (https://github.com/twpayne/chezmoi) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_FOREGROUND=0
typeset -g POWERLEVEL9K_CHEZMOI_BACKGROUND=6
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_VISUAL_IDENTIFIER_EXPANSION='⭐'
###########################[ vim_shell: vim shell indicator (:sh) ]########################### ###########################[ vim_shell: vim shell indicator (:sh) ]###########################
# Vim shell indicator color. # Vim shell indicator color.
typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0
@ -797,6 +790,13 @@
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]##################
# chezmoi shell color.
typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=0
typeset -g POWERLEVEL9K_CHEZMOI_SHELL_BACKGROUND=4
# Custom icon.
# typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ disk_usage: disk usage ]################################## ##################################[ disk_usage: disk usage ]##################################
# Colors for different levels of disk usage. # Colors for different levels of disk usage.
typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3

@ -107,7 +107,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON 'svn'$q VCS_SVN_ICON 'svn'$q
RUST_ICON 'R' RUST_ICON 'R'
PYTHON_ICON '\uE63C'$s #  (doesn't always work) PYTHON_ICON '\uE63C'$s #  (doesn't always work)
CHEZMOI_ICON '\uf015' #  CHEZMOI_ICON '\uE12C'$s # 
SWIFT_ICON 'Swift' SWIFT_ICON 'Swift'
GO_ICON 'Go' GO_ICON 'Go'
GOLANG_ICON 'Go' GOLANG_ICON 'Go'
@ -244,7 +244,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON 'svn'$q VCS_SVN_ICON 'svn'$q
RUST_ICON '\uE6A8' #  RUST_ICON '\uE6A8' # 
PYTHON_ICON '\uE63C'$s #  PYTHON_ICON '\uE63C'$s # 
CHEZMOI_ICON '\uf015' #  CHEZMOI_ICON '\uF015'$s # 
SWIFT_ICON 'Swift' SWIFT_ICON 'Swift'
GO_ICON 'Go' GO_ICON 'Go'
GOLANG_ICON 'Go' GOLANG_ICON 'Go'
@ -386,7 +386,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON 'svn'$q VCS_SVN_ICON 'svn'$q
RUST_ICON '\uE6A8' #  RUST_ICON '\uE6A8' # 
PYTHON_ICON '\U1F40D' # 🐍 PYTHON_ICON '\U1F40D' # 🐍
CHEZMOI_ICON "${CODEPOINT_OF_AWESOME_HOME:+\\u$CODEPOINT_OF_AWESOME_HOME}" CHEZMOI_ICON "${CODEPOINT_OF_AWESOME_HOME:+\\u$CODEPOINT_OF_AWESOME_HOME$s}"
SWIFT_ICON '\uE655'$s #  SWIFT_ICON '\uE655'$s # 
PUBLIC_IP_ICON "${CODEPOINT_OF_AWESOME_GLOBE:+\\u$CODEPOINT_OF_AWESOME_GLOBE$s}" PUBLIC_IP_ICON "${CODEPOINT_OF_AWESOME_GLOBE:+\\u$CODEPOINT_OF_AWESOME_GLOBE$s}"
LOCK_ICON "${CODEPOINT_OF_AWESOME_LOCK:+\\u$CODEPOINT_OF_AWESOME_LOCK}" LOCK_ICON "${CODEPOINT_OF_AWESOME_LOCK:+\\u$CODEPOINT_OF_AWESOME_LOCK}"
@ -522,7 +522,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON '\uE72D'$q #  VCS_SVN_ICON '\uE72D'$q # 
RUST_ICON '\uE7A8'$q #  RUST_ICON '\uE7A8'$q # 
PYTHON_ICON '\UE73C ' #  PYTHON_ICON '\UE73C ' # 
CHEZMOI_ICON '\Uf015' #  CHEZMOI_ICON '\uF015'$s # 
SWIFT_ICON '\uE755' #  SWIFT_ICON '\uE755' # 
GO_ICON '\uE626' #  GO_ICON '\uE626' # 
GOLANG_ICON '\uE626' #  GOLANG_ICON '\uE626' # 
@ -660,7 +660,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON '\uE72D'$q #  VCS_SVN_ICON '\uE72D'$q # 
RUST_ICON '\uE7A8'$q #  RUST_ICON '\uE7A8'$q # 
PYTHON_ICON '\UE73C ' #  PYTHON_ICON '\UE73C ' # 
CHEZMOI_ICON '\Uf015' #  CHEZMOI_ICON '\uF015'$s # 
SWIFT_ICON '\uE755' #  SWIFT_ICON '\uE755' # 
GO_ICON '\uE626' #  GO_ICON '\uE626' # 
GOLANG_ICON '\uE626' #  GOLANG_ICON '\uE626' # 
@ -795,6 +795,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON '' VCS_SVN_ICON ''
RUST_ICON 'rust' RUST_ICON 'rust'
PYTHON_ICON 'py' PYTHON_ICON 'py'
CHEZMOI_ICON 'chezmoi'
SWIFT_ICON 'swift' SWIFT_ICON 'swift'
GO_ICON 'go' GO_ICON 'go'
GOLANG_ICON 'go' GOLANG_ICON 'go'
@ -931,6 +932,7 @@ function _p9k_init_icons() {
VCS_SVN_ICON '' VCS_SVN_ICON ''
RUST_ICON 'R' RUST_ICON 'R'
PYTHON_ICON 'Py' PYTHON_ICON 'Py'
CHEZMOI_ICON 'Chez'
SWIFT_ICON 'Swift' SWIFT_ICON 'Swift'
GO_ICON 'Go' GO_ICON 'Go'
GOLANG_ICON 'Go' GOLANG_ICON 'Go'

@ -4260,19 +4260,17 @@ instant_prompt_vi_mode() {
fi fi
} }
################################################################ # Chezmoi shell indicator: https://www.chezmoi.io/
# Segment to display chezmoi information. prompt_chezmoi_shell() {
# More information: https://www.chezmoi.io/ _p9k_prompt_segment $0 blue $_p9k_color1 CHEZMOI_ICON 0 '' ''
prompt_chezmoi() {
_p9k_prompt_segment "$0" "black" "white" 'CHEZMOI_ICON' 0 '' "chezmoi"
} }
_p9k_prompt_chezmoi_init() { _p9k_prompt_chezmoi_shell_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$CHEZMOI' typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$CHEZMOI'
} }
function instant_prompt_chezmoi() { function instant_prompt_chezmoi_shell() {
_p9k_prompt_segment prompt_chezmoi "black" "white" CHEZMOI_ICON 0 '' 'chezmoi' _p9k_prompt_segment prompt_chezmoi_shell blue $_p9k_color1 CHEZMOI_ICON 1 '$CHEZMOI_ICON' ''
} }
################################################################ ################################################################

Loading…
Cancel
Save