From 1460818ecbe2fd6abdac4dbcdfa53c234e9f680a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 21 Mar 2019 21:40:57 +0100 Subject: [PATCH] zsh magic --- configs/shells.nix | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/configs/shells.nix b/configs/shells.nix index 02eddef..6e8e764 100644 --- a/configs/shells.nix +++ b/configs/shells.nix @@ -68,13 +68,13 @@ in { ''; promptInit = '' autoload -Uz vcs_info - zstyle ':vcs_info:*:' enable git - zstyle ':vcs_info:*:' check-for-changes true - zstyle ':vcs_info:*:' stagedstr '%F{green}+%f' - zstyle ':vcs_info:*:' unstagedstr '%F{red}~%f' - zstyle ':vcs_info:*:' use-prompt-escapes true - zstyle ':vcs_info:*:' formats "%c%u%F{cyan}%b%f" - zstyle ':vcs_info:*:' actionformats "(%a) %c%u%F{cyan}%b%f" + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' stagedstr '%F{green}+%f' + zstyle ':vcs_info:*' unstagedstr '%F{red}~%f' + zstyle ':vcs_info:*' use-prompt-escapes true + zstyle ':vcs_info:*' formats "%c%u%F{cyan}%b%f" + zstyle ':vcs_info:*' actionformats "(%a) %c%u%F{cyan}%b%f" precmd () { vcs_info @@ -85,6 +85,16 @@ in { PROMPT='%B%~%b %(?.%F{green}.%F{red})%#%f ' fi } + + zle-keymap-select zle-line-init () { + case $KEYMAP in + vicmd) print -n '\e]12;green\a';; + viins|main) print -n '\e]12;gray\a';; + esac + } + + zle -N zle-line-init + zle -N zle-keymap-select ''; };