From c08a209e20060dda39a1d253eb7585ef4c2b4ac9 Mon Sep 17 00:00:00 2001 From: Christian Schulze Date: Sat, 19 Sep 2015 13:35:11 +1000 Subject: [PATCH 1/2] add vi-mode segment --- README.md | 1 + powerlevel9k.zsh-theme | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index f1208f2d..7d78b6a7 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,7 @@ currently available are: * **aws** - The current AWS profile, if active (more info below) * **context** - Your username and host (more info below) +* **vi_mode** - Vi editing mode (NORMAL|INSERT). * **dir** - Your current working directory. * **history** - The command number for the current line. * **ip** - Shows the current IP address. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 5a269f90..73335b60 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -575,6 +575,16 @@ prompt_context() { fi } +# Vi Mode: show editing mode (NORMAL|INSERT) +prompt_vi_mode() { + local mode="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}" + if [[ "$mode" == "NORMAL" ]]; then + $1_prompt_segment "$0" "$DEFAULT_COLOR" "default" "$mode" + else + $1_prompt_segment "$0" "$DEFAULT_COLOR" "blue" "$mode" + fi +} + # Dir: current working directory prompt_dir() { local current_path='%~' From 665ed59e6a52af358548539b3e2aacd9e1daa120 Mon Sep 17 00:00:00 2001 From: Christian Schulze Date: Sat, 19 Sep 2015 13:48:23 +1000 Subject: [PATCH 2/2] $0 suffixes for color customization --- powerlevel9k.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 73335b60..825d51ab 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -579,9 +579,9 @@ prompt_context() { prompt_vi_mode() { local mode="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}" if [[ "$mode" == "NORMAL" ]]; then - $1_prompt_segment "$0" "$DEFAULT_COLOR" "default" "$mode" + $1_prompt_segment "$0_NORMAL" "$DEFAULT_COLOR" "default" "$mode" else - $1_prompt_segment "$0" "$DEFAULT_COLOR" "blue" "$mode" + $1_prompt_segment "$0_INSERT" "$DEFAULT_COLOR" "blue" "$mode" fi }