zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Subject: [PATCH] [RFC] _vim: handle special values for -u/-U
Date: Thu,  3 May 2018 12:27:58 +0200	[thread overview]
Message-ID: <20180503102758.30478-1-genml+zsh-workers@thequod.de> (raw)

From: Daniel Hahler <git@thequod.de>

This is based on state=verbosity from the same file, please review.
---
 Completion/Unix/Command/_vim | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 042974338..e1db47761 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -41,7 +41,7 @@ arguments=(
   '-T[set terminal type]:::_terminals'
   '--not-a-term[skip warning for input/output not being a terminal]'
   '--ttyfail[exit if input or output is not a terminal]'
-  '-u[use given vimrc file instead of default .vimrc]::rc file:_files'
+  '-u[use given vimrc file instead of default .vimrc]:config:->config'
   "--noplugin[don't load plugin scripts]"
   '-o-[number of windows to open (default: one for each file)]::window count: '
   '-O-[number of windows to vertically split open (default is one for each file)]::window count: '
@@ -90,7 +90,7 @@ arguments=(
   '--role[set unique role to identify main window]:role'
   '--socketid[open vim inside another GTK widget]:xid'
   '--echo-wid[echo window ID on stdout]'
-  '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
+  '-U[use given gvimrc file instead of default .gvimrc]:gui config:->configgui'
 )
 
 _arguments -C -S $arguments && ret=0
@@ -120,6 +120,23 @@ elif [[ $state = verbosity ]]; then
     fi
     (( ret )) || break
   done
+elif [[ "$state" = config* ]]; then
+  _tags special files
+  local names=(
+      "NONE:'skip initialization from files and environment variables'"
+      "NORC:'same as NONE, but load plugins'"
+  )
+  # gvim only supports -U NONE to skip GUI initialization.
+  [[ $state != configgui || $service != *g* ]] && names+=(
+      "DEFAULTS:'same as NONE, but loads defaults.vim'"
+  )
+  while _tags; do
+    _requested special && _describe -V 'special' "(${(F)names})" && ret=0
+    if _requested files expl 'rc file'; then
+      _files "$expl[@]" && ret=0
+    fi
+    (( ret )) || break
+  done
 fi
 
 return ret
-- 
2.17.0


                 reply	other threads:[~2018-05-03 10:28 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=20180503102758.30478-1-genml+zsh-workers@thequod.de \
    --to=genml+zsh-workers@thequod.de \
    --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).