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

流过昼夜 提交于 2019-12-12 08:47:33

问题


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?


回答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



回答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.



来源:https://stackoverflow.com/questions/81022/how-to-autocomplete-at-the-kornshell-command-line-with-the-vi-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!