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

29,046

Solution 1

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

Solution 2

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.

Share:
29,046
David
Author by

David

Software developer currently programming in UNIX and C

Updated on January 04, 2020

Comments

  • David
    David over 4 years

    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?

  • paxdiablo
    paxdiablo almost 16 years
    Risky talking about the previous answer: order can change based on votes - a better solution would be to quote the previous and expand on it.