From 6740f08f61395665714fbba150c82e99ffe0e784 Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Thu, 18 May 2023 11:57:40 +0200 Subject: [PATCH 1/6] chezmoi: add chezmoi prompt --- internal/p10k.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index a3541ba..dea5e26 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4260,6 +4260,17 @@ instant_prompt_vi_mode() { fi } +################################################################ +# Segment to display chezmoi information. +# More information: https://www.chezmoi.io/ +prompt_chezmoi() { + _p9k_prompt_segment "$0" "blue" "$_p9k_color1" '' 0 '' "chezmoi" +} + +_p9k_prompt_chezmoi_init() { + typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$CHEZMOI' +} + ################################################################ # Virtualenv: current working virtualenv # More information on virtualenv (Python): From 29c0b258505c5214667c20ce4cb5d4f7e743776c Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Sun, 21 May 2023 21:42:09 +0200 Subject: [PATCH 2/6] feat: enable chezmoi prompt in configurations --- config/p10k-classic.zsh | 1 + config/p10k-lean-8colors.zsh | 1 + config/p10k-lean.zsh | 1 + config/p10k-pure.zsh | 1 + config/p10k-rainbow.zsh | 1 + 5 files changed, 5 insertions(+) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index d29aa2f..25c2f79 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -42,6 +42,7 @@ status # exit code of the last command command_execution_time # duration of the last command background_jobs # presence of background jobs + chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi) direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 9fbd5fa..608e93f 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -42,6 +42,7 @@ status # exit code of the last command command_execution_time # duration of the last command background_jobs # presence of background jobs + chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi) direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 844c1bf..c427b52 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -42,6 +42,7 @@ status # exit code of the last command command_execution_time # duration of the last command background_jobs # presence of background jobs + chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi) direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) diff --git a/config/p10k-pure.zsh b/config/p10k-pure.zsh index 97c1a20..4682fc7 100644 --- a/config/p10k-pure.zsh +++ b/config/p10k-pure.zsh @@ -51,6 +51,7 @@ newline # \n virtualenv # python virtual environment prompt_char # prompt symbol + chezmoi # chezmoi prompt (https://github.com/twpayne/chezmoi) ) # Right prompt segments. diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index c21d879..5213589 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -45,6 +45,7 @@ direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) 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/) pyenv # python environment (https://github.com/pyenv/pyenv) goenv # go environment (https://github.com/syndbg/goenv) From 6db5920bb9ecdba25b8253a93120f973b686199f Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Sun, 21 May 2023 21:45:11 +0200 Subject: [PATCH 3/6] feat: add chezmoi icon --- internal/icons.zsh | 5 +++++ internal/p10k.zsh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/icons.zsh b/internal/icons.zsh index 6b3a9b0..b5f1d0e 100644 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -107,6 +107,7 @@ function _p9k_init_icons() { VCS_SVN_ICON 'svn'$q RUST_ICON 'R' PYTHON_ICON '\uE63C'$s #  (doesn't always work) + CHEZMOI_ICON '\uf015' #  SWIFT_ICON 'Swift' GO_ICON 'Go' GOLANG_ICON 'Go' @@ -243,6 +244,7 @@ function _p9k_init_icons() { VCS_SVN_ICON 'svn'$q RUST_ICON '\uE6A8' #  PYTHON_ICON '\uE63C'$s #  + CHEZMOI_ICON '\uf015' #  SWIFT_ICON 'Swift' GO_ICON 'Go' GOLANG_ICON 'Go' @@ -384,6 +386,7 @@ function _p9k_init_icons() { VCS_SVN_ICON 'svn'$q RUST_ICON '\uE6A8' #  PYTHON_ICON '\U1F40D' # 🐍 + CHEZMOI_ICON "${CODEPOINT_OF_AWESOME_HOME:+\\u$CODEPOINT_OF_AWESOME_HOME}" SWIFT_ICON '\uE655'$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}" @@ -519,6 +522,7 @@ function _p9k_init_icons() { VCS_SVN_ICON '\uE72D'$q #  RUST_ICON '\uE7A8'$q #  PYTHON_ICON '\UE73C ' #  + CHEZMOI_ICON '\Uf015' #  SWIFT_ICON '\uE755' #  GO_ICON '\uE626' #  GOLANG_ICON '\uE626' #  @@ -656,6 +660,7 @@ function _p9k_init_icons() { VCS_SVN_ICON '\uE72D'$q #  RUST_ICON '\uE7A8'$q #  PYTHON_ICON '\UE73C ' #  + CHEZMOI_ICON '\Uf015' #  SWIFT_ICON '\uE755' #  GO_ICON '\uE626' #  GOLANG_ICON '\uE626' #  diff --git a/internal/p10k.zsh b/internal/p10k.zsh index dea5e26..b2b07aa 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4264,7 +4264,7 @@ instant_prompt_vi_mode() { # Segment to display chezmoi information. # More information: https://www.chezmoi.io/ prompt_chezmoi() { - _p9k_prompt_segment "$0" "blue" "$_p9k_color1" '' 0 '' "chezmoi" + _p9k_prompt_segment "$0" "black" "white" 'CHEZMOI_ICON' 0 '' "chezmoi" } _p9k_prompt_chezmoi_init() { From 9ed51ec315cd438063f6514e50dd630bad9c62f2 Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Sun, 21 May 2023 21:54:50 +0200 Subject: [PATCH 4/6] doc: add chezmoi prompt in the README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 314f839..210c6b8 100644 --- a/README.md +++ b/README.md @@ -314,6 +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 | | `background_jobs` | presence of background jobs | | `battery` | internal battery state and charge level (yep, batteries *literally* included) | +| `chezmoi` | [chezmoi](https://github.com/twpayne/chezmoi) shell | | `command_execution_time` | duration (wall time) of the last command | | `context` | user@hostname | | `cpu_arch` | CPU architecture | From 7b197465803cd5f646e916b631f1b239d02efebf Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Sat, 10 Jun 2023 14:09:50 +0200 Subject: [PATCH 5/6] feat: add color and custom icon --- config/p10k-classic.zsh | 6 ++++++ config/p10k-lean-8colors.zsh | 6 ++++++ config/p10k-lean.zsh | 6 ++++++ config/p10k-rainbow.zsh | 7 +++++++ 4 files changed, 25 insertions(+) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 25c2f79..74c0540 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -737,6 +737,12 @@ # Custom icon. # 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 indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 608e93f..70c8766 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -735,6 +735,12 @@ # Custom icon. # 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 indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=3 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index c427b52..5e58b44 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -731,6 +731,12 @@ # Custom icon. # 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 indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 5213589..ce57757 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -759,6 +759,13 @@ # Custom icon. # 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 indicator color. typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 From 3ecef8c6a5d12d7aaf0335efc3483c4145371337 Mon Sep 17 00:00:00 2001 From: Alkindi42 Date: Sat, 10 Jun 2023 14:25:17 +0200 Subject: [PATCH 6/6] feat(chezmoi): add instant_prompt_chezmoi --- internal/p10k.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index b2b07aa..5a72b7e 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4271,6 +4271,10 @@ _p9k_prompt_chezmoi_init() { typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$CHEZMOI' } +function instant_prompt_chezmoi() { + _p9k_prompt_segment prompt_chezmoi "black" "white" CHEZMOI_ICON 0 '' 'chezmoi' +} + ################################################################ # Virtualenv: current working virtualenv # More information on virtualenv (Python):