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

Re: Completion on cd



On Feb 2, 10:12am, pws@xxxxxx wrote:

> Remember you can stick '+' at the end of a completion to use the
> default as a default.  You could also try the patch I posted recently

That could be useful - I didn't know about it.

> for binding specific completions (find it at http://www.peak.org/zsh/ ,
> it's called something like 'completion widgets' and should apply
> cleanly to zsh-e.1.2-zefram3).  Then you do
> and use the special key sequence.  This is probably the only way of
> getting the level of control you want.

Well, I thing my compctl -Tx 's[~] C[0,[^/]#]' -k users -S/ completion
is doing all I want. I'll try those completion widgets though: they will
probably be useful for alternative user name completion for other
instances.

> Either you have different expectations or a different version of the
> shell from me.  Try with zsh -f again.  However, I don't understand
> where you're expecting the second / to come from, since -W will strip
> it --- it's for an implicit path, i.e. one which doesn't appear on the
> command line.  I would simply omit the -W and type the second / by
> hand or use some other compctl option to get it inserted if you
> insist, or alternatively change the omitted prefix to 's[file://]'.
> In fact, you shouldn't need to do even that since of course
> '//users/...' is recognised as a path, and -W doesn't strip more than
> you've asked it to.

I don't want a second /. A file URL is of one of two forms:

file:/path
 or
file://host/path

so I only want one / and I deal with s[file://] separately.
Anyway, I have got it working and am not quite sure why it wasn't
working before. Is there a way to have no suffix: -S '' doesn't seem to
work? Anyway, just in case anyone else wants to use it and can be
bothered to adjust it for their local web server name, it is as follows:

compctl -k '(http:// file: ftp:// gopher:// news://)' -S '' \
        -x 's[file://]' -k hostnames -S/ \
        - 's[file:/]' -/g '*.html' -W/ - 's[file:]' -s '`pwd`' -S '/' \
        - 's[http://www.york.ac.uk/~'$USER'/]' -/g '*.html' -W ~/web \
        - 's[http://www.york.ac.uk/~]' -k users -S/ + -u -S/ \
        - 's[http://www.york.ac.uk/]' -g '*.html' -W '/usr/local/web' \
        - 's[http://www]' -k '(.york.ac.uk)' -S/ \
        - 's[http://a]' -k '(tlas.cs.york.ac.uk)' -S/ \
        - 's[http://]' -k '(atlas www)' -S '.' \
        - 's[-]' -k '(anonymous auth base book buried_news cache case
cfg child cookies crawl display dump editor emacskeys enable_scrollback
error_file fileversions force_html from ftp get_data head help
historical homepage image_links index link localhost locexec mime_header
minimal newschunksize newsmaxchunk nobrowse noexec nofilereferer
nofilereferer nolist nolog nopause noprint noredir noreferer nosocks
nostatus number_links popup post_data print pseudo_inlines raw realm
reload restrictions resubmit_posts rlogin selective show_cursor source
startfile_ok telnet term trace traversal underscore validate version
vikeys)' \
        -- lynx

Cheers

Oliver Kiddle


-- 
 __
/  \|.   _ _  |_/. _| _|| _     E-mail: opk101@xxxxxxxxxxxxx
\__/||\/(-|   | \|(_|(_||(-        Web: http://www.york.ac.uk/~opk101/



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