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

compsys issues

    Hi all :)

    As I told a couple of messages ago, I'm playing with the new
completion system but without using the set of functions shipped with
zsh, since I want to learn as goog as I can how it works.

    Obviously, this leads to problems...

    Anyway, I want to ask you a question about compsys. Let's say I
set up this simple widget for learning:

    # expand-or-complete is currently bound to <TAB>
    zle -C expand-or-complete expand-or-complete _completer

    function _completer () {

        compstate[insert]=${compstate[insert]//tab /}

        compadd -f - $PREFIX*(/)

        return 0

    When I write 'cd ' at the prompt and hit tab, I'm presented with
the list of subdirs in the current dir (e.g):

    $ cd <TAB>
    Projects/ Music/ Work/ temporary/

    Let's say I pick 'Projects' and hit tab again. Now I'm presented
with this:

    $ cd Projects/<TAB>

    Projects/mta/ Projects/zsh-things/ Projects/more/

    But what I want is to be presented with:

    $ cd Projects/<TAB>

    mta/ zsh-things/ more/

    that's what I'm presented with the default .expand-or-complete
widget, and that's the behaviour I want.

    I've tried tweaking IPREFIX and PREFIX (with and without the help
from compset), I've tried generating the list of matches before
calling compadd, cleaning the undesired part before, etc. and nothing
works. I've read the info pages for compadd, compset, the special
parameters for completion and I've even taken a look at the provided
functions and I've not learnt anything :((( I've even eat a segfault
or two when using compadd with the '-p' option.

    Could anybody lend me a hand and explain me how all this works so
I can keep on practicing? Thanks a lot in advance :)

    Raúl Núñez de Arenas Coronado

Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/

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