From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2775 invoked from network); 30 Sep 1999 12:20:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Sep 1999 12:20:04 -0000 Received: (qmail 24275 invoked by alias); 30 Sep 1999 12:19:38 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2637 Received: (qmail 24257 invoked from network); 30 Sep 1999 12:19:18 -0000 Sender: fg@s2.smtp.oleane.net Message-ID: <37F35534.DB7667F9@mandrakesoft.com> Date: Thu, 30 Sep 1999 12:19:00 +0000 From: Francis GALIEGUE Organization: MandrakeSoft X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.13-custom2 i686) X-Accept-Language: fr, en MIME-Version: 1.0 To: ZSH users list Subject: Re: zsh and RPM: a case of study (for me) References: <37F26815.B5B90B8@mandrakesoft.com> <19990929211025.A16175@thelonious.new.ox.ac.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Adam Spiers wrote: > > However, it's probably good to keep the distinction between a > (reference) manual and a tutorial/guide, and fortunately Peter's just > published an unfinished first draft of one > (http://www.ifh.de/~pws/computing/zshguide_intro.html if you missed > the post) which if first looks are to go by, will be a wonderful > complement to the very well written but tough manual. > AH, good, I'll have alook at it :) > > What are really completion widgets? Even after rereading the > > aforementioned chapters 3, 4 times I still couldn't figure it out. When > > are they called, what do they do, etc, and more importantly, HOW TO > > CREATE ONE! > > > > Just for example, lets say I have a: > > > > compctl -X bar -k "(a b)" foo > > That's your first problem. `compctl' is the old style of programmable > completion, which (in terms of configuration) is completely separate > and different to the new, widget-based style. What version do you > have installed? It sounds like you have a 3.1.something. What I say > below applies to 3.1.6; if you don't mind using a development version > with warts and all, I'd recommend you try 3.1.6 or even the latest pws > patch from http://www.ifh.de/~pws/computing/, which has all the latest > bells and whistles. > I have 3.1.6 (it's bundled with Mandrake :) ). > Try an experiment: type `bindkey' from your zsh. You'll get a list of > keys, and what widgets those keys are bound to. For example, > > "^[f" forward-word > > means when you press ESC f (or meta-f), it will invoke the > forward-word widget, which moves the cursor forward to the next word. > A completion widget is one which starts the cogs of the new > shell-script-based completion system whirring. > > However, you don't normally need to make your own completion widgets; > you just incorporate your new completion into the existing system of > widgets. For example, to convert your compctl example to the new > system: > > function _foo { > # Generate completion matches `a' and `b' with the explanation `bar' > compadd -X bar - a b > } > > # Make the command `foo' complete arguments using the function `_foo' > compdef _foo foo > OK, noted :) > (Note that all such functions like _foo above should start with an > underscore.) > > Oh, the above won't work unless you've configured your setup to work > with the new completion system. Read the `zshcompsys' man page for > details on how to do this (or just type `compinstall' if you can't be > bothered to read it :-) > It runs automagically, I got this at the end of my .zshrc: _compdir=/usr/share/zsh/functions/Core [[ -z $fpath[(r)$_compdir] ]] && fpath=($fpath $_compdir) autoload -U compinit compinit > > > Another probably dumb example: I'm used to the bash key sequences > > (C-x|Esc)(!|@|~|/|$), how can I reproduce them in a simple manner? > > You should find that many (most?) of them already work in zsh. If you > find you're really missing any of them, let us know and I'm sure one > of us will be only to happy to help. > They don't seem to. For info, unless you already know it, what these sequences do in bash are: Esc ! -> tries to complete the current word to a command name Esc $ -> same, but for environment variables, whether the word is preceeded by a $ or not Esc @ -> machine names (from /etc/hosts) Esc / -> file name Esc ~ -> a user name C-x instead of Esc with one of the above will list matches and won't attempt any completion > > You're not the only one who wanted this behaviour, and so you'll be > glad to hear that someone's already done the hard work. There's an > _rpm function distributed with 3.1.6-pws-6 which does all you want, > and much more. > Ahaa! I'll have a look too :) Thanks for all the info. Regards, -- fg # rm *;o o: command not found