Zsh Mailing List Archive
Messages sorted by:
Re: How to do a simple find-replace autocomplete?
- X-seq: zsh-users 11644
- From: Mats Ahlgren <mats_a@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: How to do a simple find-replace autocomplete?
- Date: Sun, 15 Jul 2007 23:13:14 -0400
- Cc: "Peter Mawhorter" <pmawhorter@xxxxxxxxx>, "Mikael Magnusson" <mikachu@xxxxxxxxx>
- In-reply-to: <3442bf5a0707151933i47b9acfevfbc20c8dc178d0e6@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200707152136.40771.mats_a@xxxxxxx> <3442bf5a0707151933i47b9acfevfbc20c8dc178d0e6@xxxxxxxxxxxxxx>
- Reply-to: ahlgren@xxxxxxx
Mikael and Peter -- you're right, that *does* suit my purposes... I don't even have to press <tab>. Thank you.
To the mailing list:
However, if anyone has any autocompletion tutorial resource URL to share, it would be appreciated.
For example, an idea I just had:
How would one have the pattern "#dir" (perhaps defined via a regex) autocomplete using tab, invoking a script with the match (e.g. $ myAutoComp.py dir), which returns a newline-delimited list of possible completions to feed into the completion engine?
This could be used in conjunction with a script which returns (from a hashmap) all directories N levels deep from your home directory -- saving lots of time if you're often looking for a uniquely-named subfolders.
(sidenote: I'm more interested in the specific technique of interfacing with an outside script, rather than the end result.)
On Sunday 15 July 2007 22:33:12 Peter Mawhorter wrote:
> There may be a better way to do this tha's Zsh specific, but I've
> always just stuck a couple of variable declarations in my .zprofile:
> export $p=/home/pmawhorter/media/pictures
> and the like. When I type:
> cd $p<Tab>
> It completes to /home/pmawhorter/media/pictures.
> What is anoying is that I can't type '$p/a<Tab>' and complete directly
> to /home/pmawhorter/media/pictures/arrivals... I have to hit tab
> twice. Still, it's one way to "shortcut" directories.
> -Peter Mawhorter
> On 7/15/07, Mats Ahlgren <mats_a@xxxxxxx> wrote:
> > Hello,
> > I'd like to do a simple autocomplete, where a string (e.g. #doc) gets expanded instantly into '/home/username/documents' or somesuch
> > I've been searching online for a long time on how to do this, but couldn't find any information.
> > Would someone be so kind as to suggest a reference or provide the code snippet?
> > Thank you,
> > Mats
Messages sorted by: