I want to set tab for zsh autocomplition plugin. There is related part of config:
# Widgets that accept the entire suggestion
(( ! ${+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS} )) && {
typeset -ga ZSH_AUTOSUGGEST_ACCEPT_WIDGETS
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
forward-char
end-of-line
tab-char //my line
vi-forward-char
vi-end-of-line
vi-add-eol
)
}
What is the convention for char names used? How does tab named?
Asynchronous find-as-you-type autocompletion. … zsh-autocomplete adds real-time type-ahead autocompletion to Zsh. Find as you type, then press Tab to insert the top completion, Shift Tab to insert the bottom one, or ↓ / PgDn to select another completion.
The first step is to clone the repository: Next, remove any calls to compinit available in the ZSH config file then finally, navigate to the cloned repository and add the .zsh file to .zshrc using the source command: Once you have successfully installed the tool, you can now see auto-suggestions as you type commands:
The installation process for zsh is different in different Operating Systems. Checkout the Zsh Installation Guide to install zsh. After you install Zsh, make sure you make it your default shell. Run the following in your terminal to do so. Log out and Log in back to your default shell. Run echo $SHELL and the output /bin/zsh or similar is expected.
Press Ctrl Space in the completion menu or the history menu to insert more than one item. Works out of the box with zero configuration, but also supports zsh-z, zoxide, z.lua , rupa/z.sh, autojump and fasd. Tested to work with Zsh 5.7 or newer. Should theoretically work with Zsh 5.4 or newer, but I'm unable to test that. Then restart your shell.
You will have to put
bindkey ' ' autosuggest-accept
into your .zshrc
file. Notice that the space between the apostrophe is one keystroke of the tab-character.
This works similarly with every other character or character combination. If you for example wanted to put a combination of the ctrl
+space
keys to trigger the acception, you'd append
bindkey '^ ' autosuggest-accept
to the file.
Here's a link to the Configuration-file, where this is explained: https://github.com/zsh-users/zsh-autosuggestions#key-bindings
For all of you that are struggling with the accepted answer, I got it to work doing the following:
bindkey '^I' autosuggest-accept
...where '^I' is tab.
this seems to work as expected in your ~/.zshrc
:
bindkey '\t' autosuggest-accept
If you want to know more, you can click here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With