zsh vi mode, cursor style in normal and insert mode
This commit is contained in:
parent
2ddc04cd36
commit
4b05b6c8ec
@ -14,7 +14,36 @@ WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
|
|||||||
PROMPT_EOL_MARK=""
|
PROMPT_EOL_MARK=""
|
||||||
|
|
||||||
# configure key keybindings
|
# configure key keybindings
|
||||||
|
|
||||||
|
# Activate vim mode.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
|
||||||
|
|
||||||
|
# Change cursor shape for different vi modes.
|
||||||
|
zle-keymap-select() {
|
||||||
|
if [[ ${KEYMAP} == vicmd ]] ||
|
||||||
|
[[ $1 = 'block' ]]; then
|
||||||
|
echo -ne '\e[1 q'
|
||||||
|
|
||||||
|
elif [[ ${KEYMAP} == main ]] ||
|
||||||
|
[[ ${KEYMAP} == viins ]] ||
|
||||||
|
[[ ${KEYMAP} = '' ]] ||
|
||||||
|
[[ $1 = 'beam' ]]; then
|
||||||
|
echo -ne '\e[5 q'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
|
||||||
|
# Use beam shape cursor on startup.
|
||||||
|
echo -ne '\e[5 q'
|
||||||
|
|
||||||
|
# Use beam shape cursor for each new prompt.
|
||||||
|
preexec() {
|
||||||
|
echo -ne '\e[5 q'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bindkey -M viins 'jk' vi-cmd-mode
|
bindkey -M viins 'jk' vi-cmd-mode
|
||||||
bindkey ' ' magic-space # do history expansion on space
|
bindkey ' ' magic-space # do history expansion on space
|
||||||
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user