Add autosuggestions module
The modules uses zsh-autosuggestions as an external submodule and defines useful keybindings for vi-mode.
This commit is contained in:
parent
7227c4f0be
commit
ac3186df63
4 changed files with 27 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -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
|
||||
|
|
10
modules/autosuggestions/README.md
Normal file
10
modules/autosuggestions/README.md
Normal 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
|
1
modules/autosuggestions/external/zsh-autosuggestions
vendored
Submodule
1
modules/autosuggestions/external/zsh-autosuggestions
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 7a00bfa444fcd474bce9c56119d573afa2b51aba
|
13
modules/autosuggestions/init.zsh
Normal file
13
modules/autosuggestions/init.zsh
Normal 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
|
Loading…
Add table
Reference in a new issue