From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13117 invoked from network); 7 Jul 2005 10:58:36 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Jul 2005 10:58:36 -0000 Received: (qmail 56372 invoked from network); 7 Jul 2005 10:58:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Jul 2005 10:58:30 -0000 Received: (qmail 27256 invoked by alias); 7 Jul 2005 10:58:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9045 Received: (qmail 27245 invoked from network); 7 Jul 2005 10:58:22 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Jul 2005 10:58:22 -0000 Received: (qmail 55398 invoked from network); 7 Jul 2005 10:58:22 -0000 Received: from mxfep02.bredband.com (195.54.107.73) by a.mx.sunsite.dk with SMTP; 7 Jul 2005 10:58:17 -0000 Received: from puritan.pnetwork ([213.112.43.228] [213.112.43.228]) by mxfep02.bredband.com with ESMTP id <20050707105817.RAXJ21194.mxfep02.bredband.com@puritan.pnetwork> for ; Thu, 7 Jul 2005 12:58:17 +0200 Received: by puritan.pnetwork (Postfix, from userid 1000) id 5B00BADFEA; Thu, 7 Jul 2005 12:58:17 +0200 (CEST) Date: Thu, 7 Jul 2005 12:58:17 +0200 From: Nikolai Weibull To: zsh-users@sunsite.dk Subject: Re: Adding a prefix to certain filename completions Message-ID: <20050707105817.GA5452@puritan.pnetwork> Mail-Followup-To: zsh-users@sunsite.dk References: <20050705172846.GB5362@puritan.pnetwork> <20050704193711.GF6330@puritan.pnetwork> <20050705042324.GA21301@picard.franken.de> <20050705080946.GC5333@puritan.pnetwork> <1050706050022.ZM13972@candle.brasslantern.com> <20050706113154.GA5313@puritan.pnetwork> <20050707020210.GA5084@puritan.pnetwork> <1050707054007.ZM14965@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <1050707054007.ZM14965@candle.brasslantern.com> User-Agent: Mutt/1.5.8i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Bart Schaefer wrote: > [Aside: Is it possible for you to convince your mail client not to > send text labeled us-ascii when it contains multi-byte characters (I > think they must be Unicode apostrophes?) It makes it quite difficult > to read. I've manually edited them back to ' in the excerpt.] As Dan Nelson points out, it all seems to be in order. I don't want to push it back at you, but perhaps your mail client is being fooled by the mime-type of the second attachment (which was us-ascii). Anyway, if this problem persists, I can live without using fancy apostrophes on this list. > On Jul 7, 4:02am, Nikolai Weibull wrote: > > There's a problem with the + option, though. I couldn't figure out > > a proper way of escaping the + that is the options name (just using \+ > > doesn't work). > The + is not the option's name. The name is whatever comes *after* the > initial - or + that introduces the option. In fact, in this case + > is not really an option at all; really it's a non-option argument that > happens to be allowed to be mixed in among the options. OK. > I prefer the behavior of the modified _my_files (which, by the way, > should probably be renamed _vim_files if this is going to be added to > the stock completions). Done. I modified the function a bit to handle files named + a bit better: _vim_files () { if [[ $(echo $PREFIX*(N)) == '' ]]; then case $PREFIX in (+) _message -e 'start at a given line (default: end of file)' ;; (+<1->) _message -e 'line number' ;; esac fi case $PREFIX in (+*) _files -P './' $* ;; (*) _files $* ;; esac } This may not be the best solution, though. I kind of hope that there's a nicer way to test if there are any files having $PREFIX as a prefix. Thank you for your help, 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);} --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_vim #compdef vim _vim_files () { if [[ $(echo $PREFIX*(N)) == '' ]]; then case $PREFIX in (+) _message -e 'start at a given line (default: end of file)' ;; (+<1->) _message -e 'line number' ;; esac fi case $PREFIX in (+*) _files -P './' $* ;; (*) _files $* ;; esac } 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:_vim_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: ' '*--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:_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-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:_vim_files' ) _arguments -S $arguments --ZPt4rx8FFjLCG7dd--