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

Re: filecompletion in ksh93 (fwd)



This is interesting; I haven't seen a recent ksh manual.  Looks like ksh
can do "widgets" too, after a fashion.  Use of "trap" on a magic KEYBD
signal to invoke the function is kinda cutesy.

---------- Forwarded message ----------
Date: 11 Dec 1999 09:33:05 -0500
From: Gabor <gabor@xxxxxxxxxx>
Newsgroups: comp.unix.shell
Subject: Re: filecompletion in ksh93

In comp.unix.shell, Dave Brown <dagbrown@xxxxxxxx> wrote:
# In article <82s1s9$cn5$1@xxxxxxxxxxxxxxxxxxx>,
# Ajay Matai <matai@xxxxxxxxxxx> wrote:
# : How to make tab work as filename completion in ksh?
# 
# You can't.  You have to type awkward, nonintuitive characters

Wrong.  You can.  There might be better solutions than mine here.  This one
works in vi mode, and the next one in emacs.

function vi_tab
{
    # what looks like a space on the next line is a physical tab
    if [[ ${.sh.edmode} == "" && ${.sh.edchar} == "	" ]] then
        .sh.edchar="\\"
    elif [[ ${.sh.edmode} != "" && ${.sh.edchar} == "=" ]] then
        .sh.edchar="=a"
    fi
}

trap 'vi_tab' KEYBD

function emacs_tab
{
    # what looks like a space on the next line is a physical tab
    if [[ ${.sh.edchar} == "	" ]] then
        .sh.edchar=""
    fi
}








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