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

Autocompletion how-to?


I've been experimenting with zsh with the manual as my guide, and 
can't figure out how to do a few things. Might anyone please be able 
to give insight and/or code snippets into how to create any of the 
following functionality?

Thank you.


* Have the list of completions always shown if {[size of completion 
list] < 50}, and dynamically shorten the list as you type each 

* Have hitting 'tab' and/or '/' immediately show a list of 
completions, if there is a unique match. (Currently one must 
hit 'tab' after typing '/', and must also hit 'tab' after 
autocompleting to a unique directory name.)
~/doc <tab>
~/documents/ <tab> [want to skip this line]
suggestions: music, videos, etc.
~/documents/ <tab> [want to skip hitting <tab>]
suggestions: music, videos, etc.

* Use an external script to generate completions. (I had previously 
asked about this on the mailing list, but unfortunately have not been 
able to come up with anything.)
e.g. fuzzy descendant name search: Hit a keyboard shortcut, get a 
prompt, type something in, pass the typed string to a script that 
searches for a file/folder that's a descendant of the PWD 
(using 'locate') and returns to the shell a list of completions 
ranked by edit distance

* Make it so that when $variables are expanded, they do not add a 
space after them. (e.g. if I have $docs mapped to my 'documents' 
folder, and I autocomplete '$do<tab>', then I have to hit backspace 
then type '/' then start typing the rest of the directory path)

It would also be nice to have them add a '/' if the variable contains 
any '/' string or if the variable name is somehow flagged as "should 
add a / after autocompletion"

* Have two keys bound for menu completion, which are just like 
hitting 'tab' for menu completion, except you only tab through 
directories, or only files -- not both.

* Delete everything from end of line through the nearest '/' left of 
the cursor.
Also I've been having trouble finding info on the following:

* Specify a context for when specific options are passed to functions.
For example, I have an alias, which is 'place'='mv -t' (which I want 
to use so I never accidentally rename a file when all I'm doing is 
changing its location). I'd like to make it so 'mv -t' only 
autocompletes directories as the second argument.

Sorry if one or two of these questions may be basic, but it's taken 
weeks to get comfortable with zsh's powerful autocompletion system. 

Messages sorted by: Reverse Date, Date, Thread, Author