Skip to content

Commit

Permalink
Change ⇤ behavior in completion menu
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Jun 20, 2021
1 parent ddb28e2 commit a5d6df1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,27 @@ Works out of the box with zero configuration, but also supports `zsh-z`, `zoxide
### Completion Menu
| Key(s) | Action |
| ------ | ------ |
| <kbd>↑</kbd>/<kbd>↓</kbd>/<kbd>←</kbd>/<kbd>→</kbd> | Change selection |
| <kbd>↑</kbd> / <kbd>↓</kbd> / <kbd>←</kbd> / <kbd>→</kbd> | Change selection |
| <kbd>Alt</kbd><kbd>↑</kbd> | Backward one group |
| <kbd>Alt</kbd><kbd>↓</kbd> | Forward one group |
| <kbd>PgUp</kbd>/<kbd>PgDn</kbd> | Page up/down |
| <kbd>Home</kbd>/<kbd>End</kbd> | Beginning/End of menu |
| <kbd>PgUp</kbd> / <kbd>PgDn</kbd> | Page up/down |
| <kbd>Home</kbd> / <kbd>End</kbd> | Beginning/End of menu |
| <kbd>Ctrl</kbd><kbd>R</kbd> | Full text search or previous search match |
| <kbd>Ctrl</kbd><kbd>S</kbd> | Full text search or next search match |
| <kbd>Tab</kbd> | Accept selected completion |
| <kbd>Shift</kbd><kbd>Tab</kbd> | Accept bottom completion |
| <kbd>Ctrl</kbd><kbd>Space</kbd> | Multi-select |
| <kbd>Tab</kbd> | Accept selection |
| <kbd>Shift</kbd><kbd>Tab</kbd> | Reject selection |
| <kbd>Enter</kbd> | Accept command line |

### History Menu
| Key(s) | Action |
| --- | --- |
| <kbd>←</kbd>/<kbd>→</kbd> | Accept selection & move cursor |
| <kbd>↑</kbd>/<kbd>↓</kbd> | Change selection |
| <kbd>Home</kbd>/<kbd>End</kbd> | Beginning/End of menu |
| <kbd>Tab</kbd> | Accept selected completion |
| <kbd>Shift</kbd><kbd>Tab</kbd> | Accept bottom completion |
| <kbd>Ctrl</kbd><kbd>Space</kbd> | Multi-select |
| <kbd>←</kbd>/<kbd>→</kbd> | Accept selection & move cursor |
| <kbd>Tab</kbd> | Accept selection |
| <kbd>Shift</kbd><kbd>Tab</kbd> | Reject selection |
| <kbd>Enter</kbd> | Accept command line |

## Requirements
Expand Down
8 changes: 4 additions & 4 deletions module/.autocomplete.key-binding
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ zmodload -Fa zsh/parameter p:funcstack p:functions

local tab_style; zstyle -s :autocomplete:tab: widget-style tab_style ||
tab_style='complete-word'
local backtab_style; zstyle -s :autocomplete:shift-tab: widget-style backtab_style ||
backtab_style=${tab_style:/menu-complete/reverse-menu-complete}

if zstyle -t :autocomplete:tab: fzf || zstyle -t :autocomplete:tab: fzf-completion; then
typeset -gH fzf_default_completion=$tab_style
functions[.autocomplete.fzf-completion]=$functions[fzf-completion]
Expand All @@ -30,6 +27,9 @@ zmodload -Fa zsh/parameter p:funcstack p:functions
bindkey -M emacs $key[Tab] $tab_style
bindkey -M viins $key[Tab] $tab_style
fi

local backtab_style; zstyle -s :autocomplete:shift-tab: widget-style backtab_style ||
backtab_style=${tab_style:/menu-complete/reverse-menu-complete}
bindkey -M emacs $key[Shift-Tab] $backtab_style
bindkey -M viins $key[Shift-Tab] $backtab_style

Expand All @@ -41,7 +41,7 @@ zmodload -Fa zsh/parameter p:funcstack p:functions
if [[ $backtab_style == *menu-* ]]; then
bindkey -M menuselect $key[Shift-Tab] reverse-menu-complete
else
bindkey -M menuselect $key[Shift-Tab] send-break
bindkey -M menuselect -s $key[Shift-Tab] "$key[Tab]^_$key[Shift-Tab]"
fi
}

Expand Down

0 comments on commit a5d6df1

Please sign in to comment.