feat(zsh): completion for nvim with modified files
This commit is contained in:
parent
5390b9a761
commit
af126bb2c8
1
Makefile
1
Makefile
@ -21,6 +21,7 @@ zsh:
|
||||
test -d ~/.subzsh || \
|
||||
ln -s $(PWD)/sub/zsh ~/.subzsh
|
||||
ln -s ~/.subzsh/zshrc ~/.zshrc
|
||||
ln -s ~/.subzsh/zfunc ~/.zfunc
|
||||
mkdir ~/.subzsh/plugins
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.subzsh/plugins/zsh-autosuggestions
|
||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.subzsh/plugins/zsh-syntax-highlighting
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
|
||||
# enable completion features
|
||||
fpath+=~/.zfunc
|
||||
fpath=(~/.zfunc $fpath)
|
||||
autoload -Uz compinit
|
||||
compinit -d ~/.cache/zcompdump
|
||||
compdef _nvim nvim
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||
|
||||
16
sub/zsh/zfunc/_nvim
Normal file
16
sub/zsh/zfunc/_nvim
Normal file
@ -0,0 +1,16 @@
|
||||
#compdef nvim
|
||||
#autoload
|
||||
|
||||
|
||||
_nvim() {
|
||||
subcmds=($(git diff --name-only 2>/dev/null))
|
||||
if [[ -z "$subcmds" ]]; then
|
||||
_files
|
||||
else
|
||||
_values -C 'modified files' $subcmds
|
||||
_files
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_nvim
|
||||
Loading…
x
Reference in New Issue
Block a user