Skip to content

Commit

Permalink
Improve the menu select key bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed May 22, 2021
1 parent fe7c34a commit 8054df6
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions module/.autocomplete.key-binding
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,32 @@ bindkey -M viins $key[PageUp] history-search
bindkey -M emacs $key[PageDown] menu-select
bindkey -M viins $key[PageDown] menu-select

bindkey -M menuselect $key[Return] .accept-line
bindkey -M menuselect $key[Return] .accept-line
bindkey -M menuselect $key[Control-Space] accept-and-hold
case $( bindkey -lL main ) in
*emacs* )
bindkey -M menuselect $'\C-[f' .forward-word
bindkey -M menuselect $'\C-[b' .backward-word
bindkey -M menuselect $'\C-A' .beginning-of-line
bindkey -M menuselect $'\C-E' .end-of-line
;;
*vi* )
bindkey -M menuselect $'\C-[W' .vi-forward-word
bindkey -M menuselect $'\C-[B' .vi-backward-word
bindkey -M menuselect $'\C-[0' .vi-digit-or-beginning-of-line
bindkey -M menuselect $'\C-[$' .vi-end-of-line
;;
( *emacs* )
bindkey -M menuselect '^[f' .forward-word
bindkey -M menuselect '^[F' .forward-word
bindkey -M menuselect '^[b' .backward-word
bindkey -M menuselect '^[B' .backward-word
bindkey -M menuselect '^A' .beginning-of-line
bindkey -M menuselect '^E' .end-of-line
;;
( *vi* )
bindkey -M menuselect 'b' .vi-backward-word
bindkey -M menuselect 'B' .vi-backward-blank-word
bindkey -M menuselect 'ge' .vi-backward-word-end
bindkey -M menuselect 'gE' .vi-backward-blank-word-end
bindkey -M menuselect 'w' .vi-forward-word
bindkey -M menuselect 'W' .vi-forward-blank-word
bindkey -M menuselect 'e' .vi-forward-word-end
bindkey -M menuselect 'E' .vi-forward-blank-word-end
bindkey -M menuselect '$' .vi-end-of-line
;;
esac
bindkey -M menuselect $key[Alt]$key[Up] vi-backward-blank-word
bindkey -M menuselect $key[Alt]$key[Down] vi-forward-blank-word
bindkey -M menuselect $key[PageUp] backward-word
bindkey -M menuselect $key[PageDown] forward-word
bindkey -M menuselect $key[Home] beginning-of-history
bindkey -M menuselect $key[End] end-of-history
bindkey -M menuselect $key[Escape]$key[Up] vi-backward-blank-word
bindkey -M menuselect $key[Escape]$key[Down] vi-forward-blank-word
bindkey -M menuselect $key[PageUp] backward-word
bindkey -M menuselect $key[PageDown] forward-word
bindkey -M menuselect $key[Home] beginning-of-history
bindkey -M menuselect $key[End] end-of-history

0 comments on commit 8054df6

Please sign in to comment.