home: zsh: add ctrl-{left,right} mapping

This commit is contained in:
Bruno BELANYI 2023-03-15 17:39:29 +00:00
parent 4f0a619921
commit 1db162f272

View file

@ -65,6 +65,28 @@ else
bindkey -M vicmd '^[[Z' reverse-menu-complete bindkey -M vicmd '^[[Z' reverse-menu-complete
fi fi
# Ctrl-Left moves backward one word
if [ -n "${terminfo[kLFT5]}" ]; then
bindkey -M emacs "${terminfo[kLFT5]}" backward-word
bindkey -M viins "${terminfo[kLFT5]}" backward-word
bindkey -M vicmd "${terminfo[kLFT5]}" backward-word
else
bindkey -M emacs '^[[1;5D' backward-word
bindkey -M viins '^[[1;5D' backward-word
bindkey -M vicmd '^[[1;5D' backward-word
fi
# Ctrl-Right moves forward one word
if [ -n "${terminfo[kRIT5]}" ]; then
bindkey -M emacs "${terminfo[kRIT5]}" forward-word
bindkey -M viins "${terminfo[kRIT5]}" forward-word
bindkey -M vicmd "${terminfo[kRIT5]}" forward-word
else
bindkey -M emacs '^[[1;5C' forward-word
bindkey -M viins '^[[1;5C' forward-word
bindkey -M vicmd '^[[1;5C' forward-word
fi
# PageUp goes backwards in history # PageUp goes backwards in history
if [ -n "${terminfo[kpp]}" ]; then if [ -n "${terminfo[kpp]}" ]; then
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history bindkey -M emacs "${terminfo[kpp]}" up-line-or-history