Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion and history



Jimmy Mäkelä <jmy@xxxxxxxxxxxxx> typed:
:I have got this compctl to unzip files into a directory based on their name,
:but i would like to know of a cleaner way to do this, especially the
:function. How would i for example do if i wanted to be able to add a -dNAME
:for each of the arguments before the current on the commandline like:
:unzip 1.zip 2.zip 3.zip <TAB> gives:
:unzip 1.zip 2.zip 3.zip -d1 -d2 -d3

Umm, you've got a funny version of unzip if you can specify more than one
archive.  Can it?  Also, your compzip function doesn't need to run any
other commands:

compzip() {
	local a b
	read -c a
	b=(${=a})
	reply=("-d${b[2]:r}")
}

:--------CUT-----------
:compctl -x 'p[1]' -g '*.(zip|ZIP)' - 'p[2]' -K compzip -- unzip
:
:From the compzip function:
:read -c z
:z=`echo $z|awk '{print $2}'|awk -F . '{print $1}'`
:reply=("-d$z")
:return
:----------------------
:
:And how do i get the appendhistory thing to work, what have i done wrong:
:% grep HIST .zshrc
:HISTSIZE=200
:HISTFILE=.zshistory

HISTFILE=~/.zshistory
-- 
Geoff Wing   <gcw@xxxxxxxxx>            Mobile : 0412 162 441 
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/



Messages sorted by: Reverse Date, Date, Thread, Author