From 730b0f3ca0d98146760bf603d0b4c9087feac7fe Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 4 Aug 2013 02:54:02 -0400 Subject: [PATCH] Switch to block cursor in cmd mode (iterm/mac only) --- zsh/config | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/zsh/config b/zsh/config index a55bcaab..104f32d1 100644 --- a/zsh/config +++ b/zsh/config @@ -1,3 +1,28 @@ + +# Switch between block and line cursor (Only in iterm) +if is_mac; then + function zle-keymap-select zle-line-init + { + # change cursor shape in iTerm2 + case $KEYMAP in + vicmd) print -n -- "\E]50;CursorShape=0\C-G";; # block cursor + viins|main) print -n -- "\E]50;CursorShape=1\C-G";; # line cursor + esac + + zle reset-prompt + zle -R + } + + function zle-line-finish + { + print -n -- "\E]50;CursorShape=0\C-G" # block cursor + } + + zle -N zle-line-init + zle -N zle-line-finish + zle -N zle-keymap-select +fi + # Disable autocorrect behavior, very annoying! unsetopt correct_all