zsh-workers
 help / color / mirror / code / Atom feed
From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: [patch] _vi completer
Date: Fri, 15 May 2020 21:24:14 -0500	[thread overview]
Message-ID: <20200516022414.GA20045@CptOrmolo.darkstar> (raw)

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

                 reply	other threads:[~2020-05-16  2:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200516022414.GA20045@CptOrmolo.darkstar \
    --to=phy1729@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).