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