Add autosuggestions module

The modules uses zsh-autosuggestions as an external submodule and defines
useful keybindings for vi-mode.
This commit is contained in:
Tobias Witt 2016-01-07 10:55:59 +01:00
parent 7227c4f0be
commit ac3186df63
No known key found for this signature in database
GPG key ID: F4AB9D0041E48E7E
4 changed files with 27 additions and 0 deletions

3
.gitmodules vendored
View file

@ -16,3 +16,6 @@
[submodule "modules/prompt/functions/pure"]
path = modules/prompt/external/pure
url = https://github.com/sindresorhus/pure.git
[submodule "modules/autosuggestions/external/zsh-autosuggestions"]
path = modules/autosuggestions/external/zsh-autosuggestions
url = https://github.com/tarruda/zsh-autosuggestions

View file

@ -0,0 +1,10 @@
# ZSH Autosuggestions
This plugin enables [zsh-autosuggestions](https://github.com/tarruda/zsh-autosuggestions) and adds
vi-mode compatible keybindings.
## Keybindings
* `CTRL-F` is bound to `vi-forward-word`, it is equivalent to hitting `w` in vim and accepts the
suggestion word by word
* `CTRL-K` is bound to `vi-end-of-line` which effectively accepts the suggestion

@ -0,0 +1 @@
Subproject commit 7a00bfa444fcd474bce9c56119d573afa2b51aba

View file

@ -0,0 +1,13 @@
source "${0:h}/external/zsh-autosuggestions/autosuggestions.zsh" || return 1
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-init
zstyle -s ':prezto:module:editor' key-bindings 'key_bindings'
if [[ "$key_bindings" == vi ]]; then
bindkey '' vi-forward-word
bindkey ' ' vi-end-of-line
fi