summaryrefslogtreecommitdiff
path: root/lib/key-bindings.zsh
diff options
context:
space:
mode:
authorCarlo Sala <carlosalag@protonmail.com>2024-02-12 09:48:38 +0100
committerCarlo Sala <carlosalag@protonmail.com>2024-02-12 09:48:38 +0100
commit8f22370af8bd390ea3b8610da1ccf388826d909d (patch)
tree1773195190b76bce12baa03dde10d75086a93b99 /lib/key-bindings.zsh
parentbdcb4d9d1f36d5d82720dfd53f0c95242ab62dae (diff)
downloadzsh-8f22370af8bd390ea3b8610da1ccf388826d909d.tar.gz
zsh-8f22370af8bd390ea3b8610da1ccf388826d909d.tar.bz2
zsh-8f22370af8bd390ea3b8610da1ccf388826d909d.zip
fix(key-bindings): bind default arrow keys to `beginning-search`
Fixes #12197
Diffstat (limited to 'lib/key-bindings.zsh')
-rw-r--r--lib/key-bindings.zsh19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
index aaa73046e..a5650dd81 100644
--- a/lib/key-bindings.zsh
+++ b/lib/key-bindings.zsh
@@ -32,19 +32,26 @@ if [[ -n "${terminfo[knp]}" ]]; then
fi
# Start typing + [Up-Arrow] - fuzzy find history forward
-if [[ -n "${terminfo[kcuu1]}" ]]; then
- autoload -U up-line-or-beginning-search
- zle -N up-line-or-beginning-search
+autoload -U up-line-or-beginning-search
+zle -N up-line-or-beginning-search
+bindkey -M emacs "^[[A" up-line-or-beginning-search
+bindkey -M viins "^[[A" up-line-or-beginning-search
+bindkey -M vicmd "^[[A" up-line-or-beginning-search
+if [[ -n "${terminfo[kcuu1]}" ]]; then
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
fi
+
# Start typing + [Down-Arrow] - fuzzy find history backward
-if [[ -n "${terminfo[kcud1]}" ]]; then
- autoload -U down-line-or-beginning-search
- zle -N down-line-or-beginning-search
+autoload -U down-line-or-beginning-search
+zle -N down-line-or-beginning-search
+bindkey -M emacs "^[[B" down-line-or-beginning-search
+bindkey -M viins "^[[B" down-line-or-beginning-search
+bindkey -M vicmd "^[[B" down-line-or-beginning-search
+if [[ -n "${terminfo[kcud1]}" ]]; then
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search