about summary refs log tree commit diff
path: root/.config/zsh/vi-mode.zsh
blob: 07e44102a16ef4792aa3be77bc64caa4f0d908ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# vi mode
bindkey -v
# make backspace and delete behave like vim
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^H' backward-delete-char
bindkey -M viins '^[[3~' delete-char
# fix home / end
bindkey '' beginning-of-line
bindkey '' end-of-line
# display block cursor in normal mode
function zle-keymap-select zle-line-init zle-line-finish {
	case $KEYMAP in
		vicmd)      echo -ne "\e[2 q";;
		viins|main) echo -ne "\e[6 q";;
	esac
	zle reset-prompt
	zle -R
}
zle -N zle-keymap-select
zle -N zle-line-init
zle -N zle-line-finish