Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh and RPM: a case of study (for me)
- X-seq: zsh-users 2637
- From: Francis GALIEGUE <fg@xxxxxxxxxxxxxxxx>
- To: ZSH users list <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: zsh and RPM: a case of study (for me)
- Date: Thu, 30 Sep 1999 12:19:00 +0000
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- Organization: MandrakeSoft
- References: <37F26815.B5B90B8@xxxxxxxxxxxxxxxx> <19990929211025.A16175@xxxxxxxxxxxxxxxxxxxxxxx>
- Sender: fg@xxxxxxxxxxxxxxxxxx
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 <nudge> <nudge> :) ).
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author