How can I make bash tab completion behave like vim tab completion and cycle through matching matches?

前端 未结 5 695
一向
一向 2020-12-07 10:01

I\'ve been meaning to find a solution for this for YEARS.

I am sooo much more productive in vim when manipulating files than bash for this reason.

If I have<

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 10:14

    On top of

    # cycle forward
    Control-k: menu-complete
    # cycle backward
    Control-j: menu-complete-backward
    

    you may also consider adding

    # display one column with matches
    set completion-display-width 1
    

    This way you would preserve the current Tab functionality and make bash display the possibilities in one column. So instead of

    file_12340983421 file_12390983421 file_12390986421 file_12391983421
    

    you would get

    file_12340983421
    file_12390983421
    file_12390986421
    file_12391983421
    

    P.S. You can get up to date readline library from this The GNU Readline Library website.

提交回复
热议问题