From 8f22370af8bd390ea3b8610da1ccf388826d909d Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Mon, 12 Feb 2024 09:48:38 +0100 Subject: fix(key-bindings): bind default arrow keys to `beginning-search` Fixes #12197 --- lib/key-bindings.zsh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/key-bindings.zsh') 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 -- cgit v1.2.3-70-g09d2 From 92a03105acd514fe81fb3a1f581ff0daeb11cead Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Sat, 16 Aug 2025 21:26:22 +0200 Subject: docs(key-bindings): clarify comment Closes #13265 --- lib/key-bindings.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/key-bindings.zsh') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index a5650dd81..bf5d4ba30 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -117,7 +117,7 @@ bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backwa bindkey ' ' magic-space # [Space] - don't do history expansion -# Edit the current command line in $EDITOR +# Edit the current command line in $VISUAL (or $EDITOR / `vi` if not set) autoload -U edit-command-line zle -N edit-command-line bindkey '\C-x\C-e' edit-command-line -- cgit v1.2.3-70-g09d2 From 99017b8eac3d7d0e5ba01c7bf0cf9c6d38985536 Mon Sep 17 00:00:00 2001 From: Alexey Trofimenko Date: Thu, 23 Oct 2025 22:29:46 +0400 Subject: fix(key-bindings): ensure `` works if line is not empty (#13391) --- lib/key-bindings.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/key-bindings.zsh') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index bf5d4ba30..0d2cecb6a 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -112,7 +112,7 @@ bindkey -M vicmd '^[[1;5D' backward-word bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark -bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls +bindkey -s '\el' '^q ls\n' # [Esc-l] - run command: ls bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. bindkey ' ' magic-space # [Space] - don't do history expansion -- cgit v1.2.3-70-g09d2