user982733
user982733

Reputation:

ksh autocomplete and previous commands together

set -o vi-tabcomplete is turning on tab autocomplete

and

set -o emacs is turning on history ( up for previous command, down for next command )

But, if I set both in ~/.kshrc, it is turning on only one which is emacs(history) and I am not able to turn on tab autocomplete. Am I missing something?

set -o vi-tabcomplete
set -o emacs

Did the following

set -o emacs

Esc, Ctrl V -- This gave me 
$ Version AJM 93t+ 2010-02-02

Also tried doing

$ set -o emacs
$ bind "^I=complete"
ksh: bind: not found [No such file or directory]

Also put these things in .kshrc

set -o emacs
bind "^I=complete"

Now, the history alone is working, not tab complete.

Upvotes: 6

Views: 23344

Answers (5)

Ashutosh
Ashutosh

Reputation: 481

check your shell using echo $0 --> if this is ksh then. make an entry in .profile as : set -o vi

  1. for all last command executed use the keyword as : ESC+k(for backward last executed command) and ESC+j (for forward command)
  2. for auto pathcompletation use the command as ESC+\

Upvotes: 0

Bimal Jha
Bimal Jha

Reputation: 409

Just add these 2 lines in your .profile file at the end to fix this issue:

SHELL=/bin/ksh # Correct it if your ksh is at different path
exec $SHELL    # To fix autocomplete bug of standard ksh. It must be last line.

Upvotes: -1

harryssuperman
harryssuperman

Reputation: 511

In my version Version M-11/16/88f using a ksh shell not the ksh93 i get it running using two times the ESC key. Also instead of a normal way of using tab then two times the ESC key. But the behaviour is not the same is more simple that in a normal shell sh or bash when you presh TAB key you get a list of possible matches with the string you already have. Using this shell and pressing the ESC key 2 times you will get only an autocomplete when there is only one case that match. If you want to see how many cases you can use "ESC + =" combination and then continue writing.

Resume:

"ESC + ESC" => autocomplete when there is only a match case.

"ESC + =" => show all the match cases.

Upvotes: 2

user2872605
user2872605

Reputation: 11

This worked for me

Type in ~/.environ.ksh the following

set -o tabcomplete  # Auto Tab complete
set -o emacs        # History

Upvotes: 1

kubanczyk
kubanczyk

Reputation: 5941

The options vi and emacs are mutually exclusive.

Check your ksh version and update your question, please:

set -o emacs 
Ctrl-V          # (yes, press control-v) this prints ksh version

Try:

set -o emacs
bind "^I=complete"      # tab completion

What I don't remember is whether you enter literally caret-I or control-I to get the correct bind.

Upvotes: 3

Related Questions