tags:

views:

1369

answers:

2

Hi, I'm trying to enable auto complete for the command line in emacs mode. When I try:

set -o emacs
bind '^I'=complete
bind '^I'=complete-list

and relog on, I get "bind command not found" error.

Is there any other way to tab-autocomplete in emacs mode, i.e. a tab completes to the first difference? If not, how do I install bindings in ksh?

Thanks

A: 

bind is Bash/readline-specific.

From the ksh faq,

Q6.     Does ksh support file name completion?
A6.     Yes, it does.  The default key binding is <ESC><ESC>
        however, starting with the 'g' point release,  also works
        for completion.  Note, the vi users need to set -o viraw
        in order to get  completion to work.

ksh93g was released in 1994-04-30, so I'm quite surprised if it doesn't work for you... what's your ksh version?

ephemient
version M-11/16/88iThanks for your response. Is there also any way to display possible completion options under the command, i.e, if you hit esc esc and you reach a branching point, to see what your options are to make a decision?
Michael
You can build your own KEYBD trap, though that's probably outside of the realm of "easy"...
ephemient
To see the possible options, the default key binding is <ESC>=.
MatthieuF
A: 

As you found out, key binding was introduced in ksh93,

Q5. What are the major new features of KornShell 1993?
A5. The only major new interactive feature is key binding. ... (KSH-93 FAQ)

In emacs mode, hitting

<ESC>= 

gives you a list that matches the text you have typed up to that point.

Tim