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

Filename expansion within a completion widget



    Hi all :)

    Let's say I run the following script:

---
#!/bin/zsh
zle -C expand-or-complete expand-or-complete _completer

function _completer () {

    emulate -L zsh

    setopt extendedglob globdots globassign null_glob

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

    compset -P '*/'
    BASEDIR=""
    [[ $IPREFIX[1] != "/" ]] && BASEDIR="$PWD/"
    
    compadd -W $BASEDIR$IPREFIX -f - ${IPREFIX}*(:t)
    
    return 0
}
---

    Well, it handles both relative and absolute directories
correctly, but doesn't handle named directories :(( I don't
understand why because if I type 'cd ~X<TAB>' the named dir should be
expanded, shouldn't it?

    If it shouldn't, could anyone hint me how to do it? Should I
bother with any other similar problems (I mean, like mangling IPREFIX
for absolute directories and the like)?

    Thanks a lot, as always :)

    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