Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to do a simple find-replace autocomplete?



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.

Thank you,
Mats

(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: Reverse Date, Date, Thread, Author