David
David

Reputation: 14151

How to autocomplete at the KornShell command line with the vi editor

In the KornShell (ksh) on AIX UNIX Version 5.3 with the editor mode set to vi using:

set -o vi

What are the key-strokes at the shell command line to autocomplete a file or directory name?

Upvotes: 8

Views: 30171

Answers (2)

Brian Deterling
Brian Deterling

Reputation: 13734

Extending the other answers: <ESC>* will list all matching files on the command line. Then you can use the standard vi editing commands to remove the ones you don't care about. So to add to the above table:

<ESC><shift-8>             x.txt x171 x171go

Then use backspace to go get rid of the last two, or hit <ESC> again and use the h or b to go backwards and dw to delete the ones you don't want.

Upvotes: 3

paxdiablo
paxdiablo

Reputation: 882028

ESC\ works fine on AIX4.2 at least. One thing I noticed is that it only autocompletes to the unique part of the file name.

So if you have the files x.txt, x171go and x171stop, the following will happen:

Press keys:           Command line is:
x                     x
<ESC>\                x
1                     x1
<ESC>\                x171
g<ESC>\               x171go

Upvotes: 12

Related Questions