zsh: Change cursor shape for vi modes
This commit is contained in:
parent
e2f77e6faa
commit
a5727c135b
1 changed files with 20 additions and 0 deletions
|
@ -151,6 +151,26 @@ bindkey "^[." insert-last-word
|
|||
bindkey -v
|
||||
# remove the delay for switching modes
|
||||
export KEYTIMEOUT=1
|
||||
# Change cursor shape for different vi modes.
|
||||
function zle-keymap-select {
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[2 q'
|
||||
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[6 q'
|
||||
fi
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
# Use beam shape cursor on startup.
|
||||
_fix_cursor() {
|
||||
echo -ne '\e[6 q'
|
||||
}
|
||||
precmd_functions+=(_fix_cursor)
|
||||
|
||||
# space puts a space, even in cmd mode
|
||||
bindkey -a ' ' magic-space
|
||||
# always allow backspace/delete to remove letters
|
||||
|
|
Loading…
Reference in a new issue