zsh-workers
 help / color / Atom feed
* [patch] _vi completer
@ 2020-05-16  2:24 Matthew Martin
  0 siblings, 0 replies; only message in thread
From: Matthew Martin @ 2020-05-16  2:24 UTC (permalink / raw)
  To: zsh-workers

Was mentioned in #zsh today that vi doesn't have a completer.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16  2:24 [patch] _vi completer Matthew Martin

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git