如何使 bash 选项卡完成的行为类似于 vim 选项卡完成并循环匹配匹配项? [英] How can I make bash tab completion behave like vim tab completion and cycle through matching matches?

查看:20
本文介绍了如何使 bash 选项卡完成的行为类似于 vim 选项卡完成并循环匹配匹配项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多年来我一直想为此找到解决方案.

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

由于这个原因,我在 vim 中操作文件的效率比 bash 高得多.

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

如果我有

file_12390983421
file_12391983421
file_12340983421
file_12390986421

在 bash 中输入 file_1->tab ,它显然列出了:

In bash and type file_1->tab , it obviously lists:

file_12390983421 file_12391983421 file_12340983421 file_12390986421

这是一个可怕的无聊和痛苦的工作.

And this is a horrible bore and painful to work with.

vim 中的相同序列将一次一个地循环文件.

The same sequence in vim will loop through the files one at a time.

请有人告诉我如何在 bash 中执行此操作,或者如果有其他 shell 可以执行此操作,我明天将切换.

Please someone tell me how to do this in bash, or if there is another shell that can do this, I'll switch tomorrow.

推荐答案

默认情况下 TAB 绑定到 complete readline 命令.你想要的行为应该是 menu-complete .您可以通过编辑 ~/.inputrc 来更改您的 readlines 设置.要重新绑定 TAB,请添加以下行:

By default TAB is bound to the complete readline command. Your desired behavior would be menu-complete instead. You can change your readlines settings by editing ~/.inputrc. To rebind TAB, add this line:

TAB: menu-complete

有关详细信息,请参阅 man bash 中的 READLINE 部分.

For more details see the READLINE section in man bash.

这篇关于如何使 bash 选项卡完成的行为类似于 vim 选项卡完成并循环匹配匹配项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆