diff options
| author | Carlo Sala <carlosalag@protonmail.com> | 2024-02-12 09:48:38 +0100 |
|---|---|---|
| committer | Carlo Sala <carlosalag@protonmail.com> | 2024-02-12 09:48:38 +0100 |
| commit | 8f22370af8bd390ea3b8610da1ccf388826d909d (patch) | |
| tree | 1773195190b76bce12baa03dde10d75086a93b99 /lib | |
| parent | bdcb4d9d1f36d5d82720dfd53f0c95242ab62dae (diff) | |
| download | zsh-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')
| -rw-r--r-- | lib/key-bindings.zsh | 19 |
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 |
