From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5212 invoked from network); 14 Feb 1999 12:54:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Feb 1999 12:54:27 -0000 Received: (qmail 12179 invoked by alias); 14 Feb 1999 12:53:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5371 Received: (qmail 12165 invoked from network); 14 Feb 1999 12:53:51 -0000 Message-Id: <199902141154.LAA13108@Indigo.thoth.u-net.com> From: opk@thoth.u-net.com (Oliver Kiddle) Date: Sun, 14 Feb 1999 11:54:06 +0000 X-Mailer: Mail User's Shell (7.2.6 beta(3) 11/17/96) To: zsh-workers@sunsite.auc.dk Subject: Re: Completion suggestions On Feb 8, 10:12am, Sven Wischnowsky wrote: > Oliver Kiddle wrote: > > [ Quote aware completion suggestion ] > > As an option, maybe. But if you have something like zsh -c "ls f", > you'll want all files. Good point. I suppose the option would have to be aware of quoting outside the command so your example would work properly if zsh had a compctl for -l after a -c option. I'm not sure how compctl -l deals with quotes and -l doesn't seem to be working for me at the moment so I can't test it. I've made a couple of observations on differences between zsh and tcsh's completion behaviour: ~ [68]% :> "a file" ~ [69]% less "a tcsh completes to: ~ [69]% less "a file" _ whereas zsh completes to: ~ [69]% less "a file _ where the underscore is the cursor. I prefer tcsh's behaviour in this case. Also, with the following: ~ [69]% less "a fi tcsh completes as before but zsh treats us as being on the second word so is completing files newly. I think zsh is being inconsistent as I hope this will demonstrate: compctl -x 'p[1]' -f - 'p[2]' -k '(a b c)' - 'p[3]' -k '(1 2 3)' -- t While quotes are open, spaces within the quotes separate words: ~ [76]% t "a a b c ~ [76]% t "a file 1 2 3 But when quotes are closed, a quoted area is all one word. ~ [76]% t "a file" a b c and backslash quoted spaces don't separate words ~ [76]% t a\ ~ [76]% t a\ file _ Note that single quotes behave in the same way as double quotes It is difficult to say what the best thing to do is. I think zsh is wrong because it is inconsistent but admit that it is more flexible than tcsh because there is control of words within quotes. I don't think I've needed this control in any of my compctls so would be in favour of removing the inconsistency. Maybe what is needed is some way of referencing words within quotes. e.g. compctl -x 'p[1],qs[t]' -k '(1 2 3)' -- t Where the q indicates that the pattern s[t] applies within the current (quoted) word. I haven't had time to properly look at the new-style completion yet but it might lend itself to a better solution. > > Has any thought been given to implementing tcsh's complete=enhance > This is what the matching control is for. In any recent enough zsh you fantastic thanks. Seeing as there are no examples of matching control in compctl-examples even though there are some in the documentation, I thought I'd contribute my ncftp completion for it: compctl -s '`sed -e 1,2d -e s/,.\*// < ~/.ncftp/bookmarks`' \ -x 's[-]' -k '(a d C D f g G H L n p r R u V)' \ - 'c[-1,-p]' -X 'Port number to dial' \ - 'c[-1,-d]' -X 'Redial period (in seconds)' \ - 'c[-1,-g]' -X 'No. of redials to give up after' \ - 'c[-1,-n]' -X 'Max age of files to get (in days)' \ - 'C[0,*.][0,*.*]' -s '`cut -d, -f2<~/.ncftp/bookmarks`' \ -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -- ncftp It completes host nicknames from the ncftp bookmark file unless there is a '.' in the word in which case full hostnames are completed. The matching is used to treat hostnames as case-insensitive because they are and to allow the cunning stuff with '.'. It also completes the options but you might want to cut that out, especially as this was written for version 3 beta which has different options to 2.x. Oliver Kiddle