diff --git a/Makefile b/Makefile index 42a76f0..eb088af 100644 --- a/Makefile +++ b/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 diff --git a/sub/zsh/completion b/sub/zsh/completion index ae3c014..80a5938 100644 --- a/sub/zsh/completion +++ b/sub/zsh/completion @@ -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 diff --git a/sub/zsh/zfunc/_nvim b/sub/zsh/zfunc/_nvim new file mode 100644 index 0000000..8b1dd52 --- /dev/null +++ b/sub/zsh/zfunc/_nvim @@ -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