Documentation with the default key bindings #205
-
It would be nice if README contained a set of default keybindings (https://github.com/marlonrichert/zsh-autocomplete#advanced-choose-your-own-key-bindings) that are on by default, but which you can copy and partially disable (good example: https://github.com/neoclide/coc.nvim#example-vim-configuration). Right now the docs says Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Why do you want to disable Tab? What exactly would you like Tab to do? |
Beta Was this translation helpful? Give feedback.
-
Well, I like some of the experience that zsh-autocomplete gives me, but not all of it. I ended up disabling Tab, Up and Down functionality for now and living with the rest for a few days. Speaking specifically about Tab: it conflicts with fzf (see how Same with Up/Down -- it adds 1 extra keypress to my regular workflow. To enter the menu that zsh-autocomplete offers I currently use PageDown and it works for me. |
Beta Was this translation helpful? Give feedback.
-
You can use Fzf's Tab widget instead of zstyle ':autocomplete:tab:*' fzf yes This is documented here: https://github.com/marlonrichert/zsh-autocomplete/blob/master/README.md#change-tab-behavior For all other key bindings, with commit edf6f86, I've made it possible to override them manually. You can now find instructions with examples for this over here: https://github.com/marlonrichert/zsh-autocomplete/blob/master/README.md#change-other-key-bindings For your case specifically, this is probably what you want: source path/to/zsh-autocomplete
# zsh-autocomplete defines an associative array `key` that you can use.
# The following lines revert the given keys back to Zsh defaults.
bindkey $key[Up] up-line-or-history
bindkey $key[Down] down-line-or-history |
Beta Was this translation helpful? Give feedback.
-
This is awesome, thank you so much for your work! |
Beta Was this translation helpful? Give feedback.
-
@marlonrichert There is one minor nitpick that I just noticed after a day of using it. When zsh-autocomplete is off, when I press Tab and when there are multiple ambiguous candidates, the command is completed up to the point of unambiguity, and then it stops. The second Tab press reveals a menu. The third Tab activates the menu where you can navigate and pick a candidate. However, when I enable zsh-autocomplete and when I use settings that you suggested ( I wonder if it's possible to have both fzf as a priority (have opiton |
Beta Was this translation helpful? Give feedback.
-
Yes, it's all in the Readme, in the same section: https://github.com/marlonrichert/zsh-autocomplete/blob/master/README.md#change-tab-behavior What you want is this: zstyle ':autocomplete:tab:*' insert-unambiguous yes
zstyle ':autocomplete:tab:*' widget-style menu-select
zstyle ':autocomplete:tab:*' fzf yes Although, I have to add: You can usually get the completion you want with the default settings by just continuing to type ahead. For example, given the following state: > git ch
check-attr display gitattributes information
check-ignore debug gitignore/exclude files
check-mailmap show canonical names and email addresses of contacts
check-ref-format ensure that a reference name is well formed
checkout checkout branch or paths to working tree
checkout-index copy files from index to working directory
cherry find commits not merged upstream
cherry-pick apply changes introduced by some existing commits If you type just two more letters, you can already get what you want. For example: > git chou
checkout checkout branch or paths to working tree
checkout-index copy files from index to working directory
common substring: ⇤ Shift-Tab to insert
checkout Or: > git chpi
cherry-pick apply changes introduced by some existing commits I find that's using the default settings and typing a couple more letters is usually faster than doing the whole Tab dance you just described. |
Beta Was this translation helpful? Give feedback.
You can use Fzf's Tab widget instead of
zsh-autocomplete
's by adding the following to your~/.zshrc
file:zstyle ':autocomplete:tab:*' fzf yes
This is documented here: https://github.com/marlonrichert/zsh-autocomplete/blob/master/README.md#change-tab-behavior
For all other key bindings, with commit edf6f86, I've made it possible to override them manually. You can now find instructions with examples for this over here: https://github.com/marlonrichert/zsh-autocomplete/blob/master/README.md#change-other-key-bindings
For your case specifically, this is probably what you want: