2013-10-26 18:05:17 +02:00
# zsh-autosuggestions
2015-05-21 20:23:09 +02:00
_[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._
It suggests commands as you type, based on command history.
2013-10-26 18:05:17 +02:00
## Installation
2013-11-08 12:20:57 +01:00
2016-01-27 04:51:44 +01:00
### Using [Antigen](https://github.com/zsh-users/antigen)
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
1. Load `tarruda/zsh-autosuggestions` using antigen in your `~/.zshrc` file, for example:
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
```
# Load the script
antigen bundle tarruda/zsh-autosuggestions autosuggestions.zsh
2015-05-21 20:23:09 +02:00
```
2016-01-27 04:51:44 +01:00
2. Enable autosuggestions by adding the following snippet to your `~/.zshrc` file:
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
```
# Enable autosuggestions
2015-05-21 20:23:09 +02:00
zle-line-init() {
2016-01-27 04:51:44 +01:00
autosuggest_start
2015-05-21 20:23:09 +02:00
}
2016-01-27 04:51:44 +01:00
2015-05-21 20:23:09 +02:00
zle -N zle-line-init
```
2016-01-27 04:51:44 +01:00
3. Start a new terminal session or `source ~/.zshrc`
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
### Install Manually
2015-05-21 20:23:09 +02:00
1. Clone this repository to `~/.zsh/zsh-autosuggestions` (or anywhere else):
```sh
git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
```
2016-01-27 04:51:44 +01:00
2. Load and enable autosuggestions by adding the following snippet to your `~/.zshrc` file:
2015-02-18 07:02:19 +01:00
2015-05-21 20:23:09 +02:00
```sh
2016-01-27 04:51:44 +01:00
# Load the script
2015-05-21 20:23:09 +02:00
source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh
2016-01-27 04:51:44 +01:00
# Enable autosuggestions
2015-05-21 20:23:09 +02:00
zle-line-init() {
2016-01-27 04:51:44 +01:00
autosuggest_start
2015-05-21 20:23:09 +02:00
}
2016-01-27 04:51:44 +01:00
2015-05-21 20:23:09 +02:00
zle -N zle-line-init
```
2016-01-27 04:51:44 +01:00
3. Start a new terminal session or `source ~/.zshrc`
2015-05-21 20:23:09 +02:00
## How to use
2016-01-27 04:51:44 +01:00
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 ](#configuration ).
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
To accept the autosuggestion (replacing the command line contents), position your cursor at the end of the buffer and use the right arrow key.
2015-05-21 20:23:09 +02:00
2016-01-27 04:51:44 +01:00
If the autosuggestion is not what you want, go ahead and edit it. It won't execute unless you accept it.
2013-11-08 12:20:57 +01:00
2013-12-03 20:45:56 +01:00
## Configuration
2016-01-27 04:51:44 +01:00
You may override default global config variables after plugin load, i.e. put this somewhere in your .zshrc after the code that loads plugins.
2013-12-03 20:45:56 +01:00
2016-01-27 04:51:44 +01:00
- `ZSH_AUTOSUGGEST_HIGHLIGHT_COLOR` : Color to use when highlighting the autosuggestion
- `ZSH_AUTOSUGGEST_CLEAR_WIDGETS` : List of widgets that clear the autosuggestion
- `ZSH_AUTOSUGGEST_MODIFY_WIDGETS` : List of widgets that modify the autosuggestion
- `ZSH_AUTOSUGGEST_ACCEPT_WIDGETS` : List of widgets that accept the autosuggestion
2014-12-09 22:06:52 +01:00
2016-01-27 04:51:44 +01:00
See defaults and more info [here ](tarruda/zsh-autosuggestions/blob/master/lib/config.zsh ).
2014-12-09 22:06:52 +01:00
2016-01-27 04:51:44 +01:00
## Uninstallation
2015-05-23 01:51:18 +02:00
2016-01-27 04:51:44 +01:00
Just remove the config lines from `~/.zshrc` that you added during [installation ](#installation ). If you installed manually, then also delete `~/.zsh/zsh-autosuggestions` or wherever you installed it.
2015-05-21 20:23:09 +02:00
## License
This project is licensed under [MIT license ](http://opensource.org/licenses/MIT ).
For the full text of the license, see the [LICENSE ](LICENSE ) file.