2.6 KiB
zsh-autosuggestions
Fish-like fast/unobtrusive autosuggestions for zsh.
It suggests commands as you type, based on command history.
Installation
Using Antigen
-
Load
tarruda/zsh-autosuggestions
using antigen in your~/.zshrc
file, for example:# Load the script antigen bundle tarruda/zsh-autosuggestions autosuggestions.zsh
-
Enable autosuggestions by adding the following snippet to your
~/.zshrc
file:# Enable autosuggestions zle-line-init() { autosuggest_start } zle -N zle-line-init
-
Start a new terminal session or
source ~/.zshrc
Install Manually
-
Clone this repository to
~/.zsh/zsh-autosuggestions
(or anywhere else):git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
-
Load and enable autosuggestions by adding the following snippet to your
~/.zshrc
file:# Load the script source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh # Enable autosuggestions zle-line-init() { autosuggest_start } zle -N zle-line-init
-
Start a new terminal session or
source ~/.zshrc
How to use
As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed. See configuration.
To accept the autosuggestion (replacing the command line contents), position your cursor at the end of the buffer and use the right arrow key.
If the autosuggestion is not what you want, go ahead and edit it. It won't execute unless you accept it.
Configuration
You may override default global config variables after plugin load, i.e. put this somewhere in your .zshrc after the code that loads plugins.
ZSH_AUTOSUGGEST_HIGHLIGHT_COLOR
: Color to use when highlighting the autosuggestionZSH_AUTOSUGGEST_CLEAR_WIDGETS
: List of widgets that clear the autosuggestionZSH_AUTOSUGGEST_MODIFY_WIDGETS
: List of widgets that modify the autosuggestionZSH_AUTOSUGGEST_ACCEPT_WIDGETS
: List of widgets that accept the autosuggestion
See defaults and more info here.
Uninstallation
Just remove the config lines from ~/.zshrc
that you added during installation. If you installed manually, then also delete ~/.zsh/zsh-autosuggestions
or wherever you installed it.
License
This project is licensed under MIT license. For the full text of the license, see the LICENSE file.