[X-Unix] Re: zsh / spotlight / application completion

Brian Medley bpm-list-osx-unix at 4321.tv
Wed Nov 16 19:00:32 PST 2005


On Wed, Nov 16, 2005 at 08:55:42PM -0500, Lists wrote:

My bad .. I should have mentioned I was sharing a technique.

Yes, what you describe is related to finding an "i" in the entire
string.  Please try the following to try and get what you want.

$ typeset -a _apps
$ _apps=(${(f)"$(mdfind "kMDItemKind == 'Application'" | \
    perl -MFile::Basename -pe '$_ = &basename($_, ".app")')"})
$ compctl -f -x 'c[-1,-a]' -k _apps -- open

While making this it didn't occur to me that -a probably could
look up most/all Applications like mdfind.  What I changed is
adding a small perl routine to get just the application name and
modified the compctl parameters to require a match at the
beginning of the word.

Therefore i[tab] should match iCal but not OmniOutliner.

> I wasn't sure if you were sharing a technique or asking a question.
> 
> I tried your method (I use zsh but never fully "got" compctl).
> 
> It doesn't do what I'd want, which is:
> 
> 	$ open -a i[tab]
> 
> would prompt with
> 
> 	$ open -a iCal
> 	iCal iChat iDVD iMovie\ HD iPhoto\ Diet iPhoto\ Library\ Manager  
> iPhoto iStumbler iSync iTunes iWork
> 
> instead I get
> 
>  	open -a /Applications\ \(Mac\ OS\ 9\)/Acrobat\ Reader\ 5.0/Acrobat 
> \ Reader\ 5.0
> 	zsh: do you wish to see all 427 possibilities (427 lines)?
> 
> presumably because there is an 'i' matched *somewhere* but I intended  
> for it to *only* match apps which began with the letter "i"
> 
> All of my apps (except Finder) are in /Applications (I don't use OS 9  
> although it is installed)	 and the .app extension is optional, I 
> believe

-- 
~`^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-., \|/  (___)  \|/ _,.-=~'`^`
                                      @~./'O o`\.~@
      "Knowledge is Power"           /__( \___/ )__\  *PPPFFBT!*
         -- Francis Bacon               `\__`U_/'
 _.-=~'``'~=-._.-=~'``'~=-._.-=~'`^`'~= <____|'  ^^`'~=-.,__,.-=
~'^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-.,__,.-==--^'~=-.,__,.-=~'`^`


More information about the X-Unix mailing list