diff options
author | Matthew Martin <phy1729@gmail.com> | 2020-05-17 15:16:18 -0500 |
---|---|---|
committer | Matthew Martin <phy1729@gmail.com> | 2020-05-17 15:18:26 -0500 |
commit | 53052335b920a7e62de409119e24291181b1ae86 (patch) | |
tree | 0144743e126a1be8a1a1df2350738c22fc201a38 | |
parent | 7c2a740d0f20fee3b953f6738f27b8339dd97d91 (diff) | |
download | zsh-53052335b920a7e62de409119e24291181b1ae86.tar.gz zsh-53052335b920a7e62de409119e24291181b1ae86.tar.xz zsh-53052335b920a7e62de409119e24291181b1ae86.zip |
45831: Add _vi completer
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_vi | 47 |
2 files changed, 51 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 992b7b205..40ba349c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-05-17 Matthew Martin <phy1729@gmail.com> + + * 45831: Completion/Unix/Command/_vi: Add _vi completer. + 2020-05-16 Daniel Shahaf <d.s@daniel.shahaf.name> * users/24843: Doc/Zsh/compsys.yo: zshcompsys(1): Point to the diff --git a/Completion/Unix/Command/_vi b/Completion/Unix/Command/_vi new file mode 100644 index 000000000..6201299a2 --- /dev/null +++ b/Completion/Unix/Command/_vi @@ -0,0 +1,47 @@ +#compdef ex vi view + +local -a args + +if _pick_variant vim='(N|)VIM' vi --version; then + _vim + return +fi + +args=( + '-c+[execute command on the first file loaded]:command:' + '-r[recover the named files]' + '-t+[start editing at the specified tag]:tag:' + '-w+[set window size to specified number of lines]:lines:' + '*: :_files' +) + +[[ $service != view ]] && args+=( + '-R[set readonly]' +) + +[[ $service == ex ]] && args+=( + '-s[enter batch mode]' + '-v[start in vi mode]' +) + +case $OSTYPE in + *bsd*|dragonfly*) + args+=( + "-F[don't copy the entire file on start]" + '-S[set the secure option]' + ) + [[ $service != ex ]] && args+=( + '-e[start in ex mode]' + ) + ;| + netbsd*) + args+=( + '-G[start in gtags mode]' + ) + [[ $service == vi ]] && args+=( + '-l[set the lisp and showmatch options]' + ) + ;; +esac + +_arguments -s -S -A '-*' : $args |