From 2ab21674b08b24dcc793a7063ecf488ad684e6c0 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Tue, 30 Jun 2020 03:39:53 +0200 Subject: [PATCH] Switch cursor style depending on keymap --- .config/zsh/plugins/keys.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.config/zsh/plugins/keys.zsh b/.config/zsh/plugins/keys.zsh index 07b14ab..6b2155d 100644 --- a/.config/zsh/plugins/keys.zsh +++ b/.config/zsh/plugins/keys.zsh @@ -6,6 +6,16 @@ # no delay when switching into NORMAL export KEYTIMEOUT=1 + # Switch cursor style depending on mode + function zle-line-init zle-keymap-select { + case $KEYMAP in + vicmd) echo -ne "\e[1 q";; # block + viins|main) echo -ne "\e[5 q";; # beam + esac + } + zle -N zle-line-init + zle -N zle-keymap-select + bindkey '^[h' run-help ## History ## Alternatives to check out: {up,down}-line-or-search