zsh-users
 help / color / mirror / code / Atom feed
From: Nikolai Weibull <mailing-lists.zsh-users@rawuncut.elitemail.org>
To: zsh-users@sunsite.dk
Subject: Re: Adding a prefix to certain filename completions
Date: Thu, 7 Jul 2005 04:02:10 +0200	[thread overview]
Message-ID: <20050707020210.GA5084@puritan.pnetwork> (raw)
In-Reply-To: <20050706113154.GA5313@puritan.pnetwork>

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

Nikolai Weibull wrote:

> Ah, that’s great!  I’ll try to find some time today to actually write a
> complete _vim completion.

OK, so it’s sad that I can only find spare time at 2 am, but here it is,
a quite complete Vim completion defintion.  There’s a problem with the
+<n> option, though.  I couldn’t figure out a proper way of escaping the
+ that is the options name (just using \+ doesn’t work).  Anyone have
any brilliant ideas on this, or is this a problem with the _arguments
argument-parser?

Anyway, enjoy,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

[-- Attachment #2: _vim --]
[-- Type: text/plain, Size: 3360 bytes --]

#compdef vim

_my_files () {
  [[ $PREFIX == +* ]] && _files -P './' $* || _files $*
}

local arguments

arguments=(
  '(   -e -s -d -y)-v[vi mode]'
  '(-v       -d -y)-e[ex mode]'
  '(-v -e -s    -y)-d[diff mode]'
  '(-v -e -s -d   )-y[easy mode]'
  '-R[readonly mode]'
  '-Z[restricted mode]'
  '-m[modifications (writing files) not allowed]'
  '-M[modifications in text not allowed]'
  '-b[binary mode]'
  '-l[lisp mode]'
  '-C[make vim compatible with vi]'
  '-N[do not force compatibility with vi]'
  '-V-[verbosity level]::verbosity:((0\:"do not display any messages"
                                     1\:"display when viminfo file is read or written"
                                     2\:"display sourced files"
                                     5\:"display every searched tag-file"
                                     8\:"display files that trigger autocommands"
                                     9\:"display every triggered autocommand (default)"
                                    12\:"display every executed function"
                                    13\:"report every thrown, caught, finished, or discarded exception"
                                    14\:"display anything pending in a \:finally clause"
                                    15\:"display every executed ex-command"))'
  '-D[debugging mode]'
  '-n[no swap file (memory only)]'
  {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_my_files -g \*.sw\?'
  '(   -H -F)-A[start in Arabic mode]'
  '(-A    -F)-H[start in Hebrew mode]'
  '(-A -H   )-H[start in Farsi mode]'
  '-T[set terminal type]:::_terminals'
  '-u[use given RC file instead of default .vimrc]::rc file:_files'
  '--noplugin[do not 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: '
#  '\+-[start at given line (default: end of file)]::line number: '
  '*--cmd[execute given command before loading any RC files]:command: '
  '-c[executed given command after loading the first file]:command: '
  '-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]: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:_my_files'
  '--remote-silent[as --remote but without complaining if not possible]:*:file:_my_files'
  '--remote-wait[as --remote but wait for files to have been edited]:*:file:_my_files'
  '--remote-wait-silent[as --remote-wait but without complaining if not possible]:*:file:_my_files'
  '--remote-send[send given keys to vim server if possible]:keys: '
  '--remote-expr[evaluate given expression in a vim server and print result]:expression: '
  '(- *)--serverlist[list available vim servers and exit]'
  '--servername[name of vim server to send to or name of server to become]:server name: '
  '-i[use given viminfo file instead of default .viminfo]:viminfo file:_files'
  '(- *)'{-h,--help}'[print help and exit]'
  '(- *)--version[print version information and exit]'
  '*:file:_my_files'
)

_arguments -S $arguments

  reply	other threads:[~2005-07-07  2:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-04 19:37 Nikolai Weibull
2005-07-05  0:13 ` William Scott
2005-07-05  8:07   ` Nikolai Weibull
2005-07-05 15:09     ` William Scott
2005-07-05 15:23     ` William Scott
2005-07-05  4:23 ` Thomas Köhler
2005-07-05  8:09   ` Nikolai Weibull
2005-07-05 14:25     ` William Scott
2005-07-05 17:28       ` Nikolai Weibull
2005-07-05 16:56         ` John Reese
2005-07-05 17:07         ` William Scott
2005-07-06  5:00       ` Bart Schaefer
2005-07-06 11:31         ` Nikolai Weibull
2005-07-07  2:02           ` Nikolai Weibull [this message]
2005-07-07  5:40             ` Bart Schaefer
2005-07-07  7:21               ` Dan Nelson
2005-07-07 10:58               ` Nikolai Weibull
2005-07-07 11:18                 ` Peter Stephenson
2005-07-07 11:58                   ` Doug Kearns
2005-07-07 12:11                   ` Nikolai Weibull
2005-07-07 12:54                     ` Peter Stephenson
2005-07-07 19:00                       ` Thomas Köhler
2005-07-07 14:51                 ` William Scott
2005-07-07 15:57                   ` Nikolai Weibull
2005-07-08  1:24                 ` Bart Schaefer
2005-07-08 10:12                   ` Nikolai Weibull
2005-07-05 17:01 ` Bart Schaefer
2005-07-05 19:14   ` Nikolai Weibull

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=20050707020210.GA5084@puritan.pnetwork \
    --to=mailing-lists.zsh-users@rawuncut.elitemail.org \
    --cc=zsh-users@sunsite.dk \
    /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).