From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 273625f6 for ; Thu, 7 Mar 2019 06:47:36 +0000 (UTC) Received: (qmail 2421 invoked by alias); 7 Mar 2019 06:47:22 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44101 Received: (qmail 13230 invoked by uid 1010); 7 Mar 2019 06:47:21 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25376. spamassassin: 3.4.2. Clear:RC:0(133.208.98.2):SA:0(-2.6/5.0):. Processed in 1.517538 secs); 07 Mar 2019 06:47:21 -0000 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf01.biglobe.ne.jp designates 133.208.98.2 as permitted sender) X-Biglobe-Sender: From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [PATCH] _vim: better support for nvim Message-Id: <66BBD7E0-4343-4CF2-A55E-B1D4728DBBB1@kba.biglobe.ne.jp> Date: Thu, 7 Mar 2019 15:46:43 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3445.102.3) X-Biglobe-Spnum: 57310 Add options specific to nvim, and slightly modify specs for options -q, -S and -t. diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 8853fac30..d9dc1a5b3 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -19,69 +19,86 @@ typeset -A opt_args local arguments =20 arguments=3D( - '( -e -E -s -d -y)-v[vi mode]' - '(-v -E -d -y)-e[ex mode]' - '(-v -e -d -y)-E[improved ex mode]' - '(-v -e -E -s -d )-y[easy mode]' '-m[modifications (writing files) not allowed]' '-M[modifications in text not allowed]' '-b[binary mode]' '-l[lisp mode]' - '-C[start in compatible mode]' - '-N[start in incompatible mode]' - '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the = shell]' '-V-[verbosity level]::verbosity [10]:->verbosity' '-D[debugging mode]' '-n[no swap file (memory only)]' - '-nb[start as NetBean server]' {-r,-L}'[list swap files and exit or recover from a swap file]::swap = file:_vim_files -g "*.sw?(-.)"' '( -H -F)-A[start in Arabic mode]' '(-A -F)-H[start in Hebrew mode]' '(-A -H )-F[start in Farsi mode]' - '-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]: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: ' '-p-[number of tabs to open (default: one for each file)]::tab count: = ' - '(* -t)-q-[quickfix file]:*:file:_vim_files' + '(* -t)-q+[quickfix file]::file:_files' '*--cmd[execute given command before loading any RC files]:command: ' '-c[execute given command after loading the first file]:command: ' - '-S[source a session file after loading the first file]:session = file:_files' + '-S[source a session file after loading the first file]::session = file:_files' '-s[read normal-mode commands from script file]:script file:_files' '-w[append all typed commands to given file]:output file:_files' '-W[write all typed commands to given file, overwriting existing = file]:output file:_files' - '-x[edit encrypted files]' - '-X[do not connect to X server]' - '--remote[edit given files in a vim server if = possible]:*:file:_vim_files' - '--remote-silent[as --remote but without complaining if not = possible]:*:file:_vim_files' - '--remote-wait[as --remote but wait for files to have been = edited]:*:file:_vim_files' - '--remote-wait-silent[as --remote-wait but without complaining if not = possible]:*:file:_vim_files' - '--remote-send[send given keys to vim server if possible]:keys: ' - '--remote-tab[as --remote but open tab page for each = file]:*:file:_vim_files' - '--remote-tab-silent[as --remote-silent but open tab page for each = file]:*:file:_vim_files' - '--remote-tab-wait[as --remote-wait but open tab page for each = file]:*:file:_vim_files' - '--remote-tab-wait-silent[as --remote-wait-silent but open tab page = for each file]:*:file:_vim_files' - '--remote-expr[evaluate given expression in a vim server and print = result]:expression: ' - '--literal[do not expand wildcards in arguments (this is useless with = ZSH)]' - '(- *)--serverlist[list available vim servers and exit]' - '--servername[name of vim server to send to or name of server to = become]:server name:->server' '--startuptime[write startup timing messages to given file]:log = file:_files' - '--socketid[run GVIM in another window]' - '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files' '(- *)'{-h,--help}'[print help and exit]' '(- *)--version[print version information and exit]' - '(* -q)-t[edit file where tag is defined]:tag:_complete_tag' + '(* -q)-t+[edit file where tag is defined]:tag:_complete_tag' '(-t -q)*:file:_vim_files' - '--clean[start with defaults in non-compatible mode]' ) -[[ $service !=3D *g* ]] && arguments+=3D'-g[start with GUI]' +if [[ $service =3D nvim ]]; then + arguments+=3D( + '(-e -E -es -Es -s -d)-e[ex mode, read stdin as ex command]' + '(-e -E -es -Es -s -d)-E[ex mode, read stdin as text]' + '(-e -E -es -Es -s -d)-es[silent mode, read stdin as ex command]' + '(-e -E -es -Es -s -d)-Es[silent mode, read stdin as text]' + '-i[use the specified shada file]:shada file:_files' + '(- *)-v[print version information and exit]' + '(- *)--api-info[print msgpack-encoded api-metadata and exit]' + '--headless[do not start user interface]' + '--embed[use standard input and output as a msgpack-rpc channel]' + '--listen[start RPC server on the specified socket or named = pipe]:address' + ) +else + arguments+=3D( + '(-v -E -d -y)-e[ex mode]' + '(-v -e -d -y)-E[improved ex mode]' + '( -e -E -s -d -y)-v[vi mode]' + '(-v -e -E -s -d )-y[easy mode]' + '-C[start in compatible mode]' + '-N[start in incompatible mode]' + '-nb[start as NetBean server]' + '-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]' + '-X[do not connect to X server]' + '-x[edit encrypted files]' + '--remote[edit given files in a vim server if = possible]:*:file:_vim_files' + '--remote-silent[as --remote but without complaining if not = possible]:*:file:_vim_files' + '--remote-wait[as --remote but wait for files to have been = edited]:*:file:_vim_files' + '--remote-wait-silent[as --remote-wait but without complaining if = not possible]:*:file:_vim_files' + '--remote-send[send given keys to vim server if possible]:keys: ' + '--remote-tab[as --remote but open tab page for each = file]:*:file:_vim_files' + '--remote-tab-silent[as --remote-silent but open tab page for each = file]:*:file:_vim_files' + '--remote-tab-wait[as --remote-wait but open tab page for each = file]:*:file:_vim_files' + '--remote-tab-wait-silent[as --remote-wait-silent but open tab page = for each file]:*:file:_vim_files' + '--remote-expr[evaluate given expression in a vim server and print = result]:expression: ' + '--literal[do not expand wildcards in arguments (this is useless = with ZSH)]' + '(- *)--serverlist[list available vim servers and exit]' + '--servername[name of vim server to send to or name of server to = become]:server name:->server' + '--socketid[run GVIM in another window]' + '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files' + '--clean[start with defaults in non-compatible mode]' + ) +fi +[[ $service !=3D *g* && $service !=3D nvim ]] && arguments+=3D'-g[start = with GUI]' [[ $service !=3D r* ]] && arguments+=3D'-Z[restricted mode]' -[[ $service !=3D *diff ]] && arguments+=3D'(-v -e -E -s -y)-d[diff = mode]' +[[ $service !=3D *diff ]] && arguments+=3D'(-v -e -E -es -Es -s = -y)-d[diff mode]' [[ $service !=3D *view ]] && arguments+=3D'-R[readonly mode]' [[ $service =3D *g* ]] || (( ${words[(I)-g]} )) && arguments+=3D( + '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the = shell]' '-font:font:_xft_fonts' '-geometry:geometry:_x_geometry' '(-rv -reverse)'{-rv,-reverse}'[use reverse video]'