Nadav Har'El
Thu, 24 Jan 2002 12:00:47 -0800
On Thu, Jan 24, 2002, Tzafrir Cohen wrote about "[Haifux] shells completion":
> Hi
>
> One of the missing features of bash has always been the programable
> completion. Tcsh features the 'complete' commands that allows you to
>...
> Any comments?
>
> Any suggestions from the zsh zealots? Any perlsh partizans here?
Zsh has long (read, about 8 years, at least) had the most sophisticated
completion system of any of the shells. It was quite easy to get it to
complete only *.ps files for "gv", only process numbers for "kill" (except
after a minus, where signal names are completed), and much much more
complicated stuff. In fact, this was probably the biggest reason that
got me to switch to zsh in the first place.
In Zsh 4 (Redhat 7.2, for example, comes with zsh 4.0.2), the entire
completion system was reworked, to be even more sophisticated (it is
now programmed based on shell functions). But the even more exciting
news is that it comes by default with the most complete completion
you can imagine, for any unix/linux utility you could imagine (300 of
them!). It completes filenames, special parameters, username, process
numbers, and everything you else you could imagine wanting to complete.
A few examples:
$ gv<TAB>
file1.ps files2.ps.gz
$ gv -<TAB>
-ad -font -nopixmap -scalebase
-antialias -foreground -noquiet -seascape
...
$ gv -fo<TAB>
-font -foreground
$ kill -U<TAB>
-URG -USR1 -USR2
$ kill 18<TAB>
1871 pts/5 00:00:00 zsh
1888 pts/5 00:00:00 zsh
1889 pts/5 00:00:00 ps
$ chown n<TAB>
named nfsnobody nscd nyh
news nobody ntp
and so on.
To get all this wonderful magic, all you got to do in a good installation
of zsh 4 is:
autoload -U compinit
compinit
(It's probably in the zsh manual. I don't know why it's not the default.
Maybe one of the Linux distributions will make it default by sticking it
in one of the /etc/*profile files in the future...).
--
Nadav Har'El | Thursday, Jan 24 2002, 12 Shevat 5762
[EMAIL PROTECTED] |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |A Life? Cool! Where can I download one of
http://nadav.harel.org.il |those from?
--------------------------------------------------------------------------
Haifa Linux Club Mailing List (http://linuxclub.il.eu.org)
To unsub send an empty message to [EMAIL PROTECTED]