如何使 Bash 选项卡自动完成选项 OSX 循环

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10941055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:27:23  来源:igfitidea点击:

How do I make Bash' tab complete automatically cycle through options OSX

macosbashautocompletesh

提问by user1443362

Currently when I'm in my home folder and I want to cdinto Documents I type cd Dand hit Tab, Bash shows me the list of folders that match D.

目前,当我在我的主文件夹中并且我想cd进入我输入cd D并点击的文档时Tab,Bash 会向我显示匹配的文件夹列表D

What I want to occur is when I press Tab, bash autocompletes with the first option that matches what I've put in and each time I press Tabit cycles through to the next option.

我想要发生的是,当我按下时Tab,bash 自动完成第一个与我输入的选项相匹配的选项,每次按下Tab它时都会循环到下一个选项。

Is there any way to do this? I thought for sure my copy of Bash on my old Ubuntu box had this feature.

有没有办法做到这一点?我想我的旧 Ubuntu 机器上的 Bash 副本肯定有这个功能。

回答by xizdaqrian

Yes! I found the answer to the question at the following link at MacWorld

是的!我在 MacWorld的以下链接中找到了问题的答案

put the following in .bashrc or .bash_login

将以下内容放入 .bashrc 或 .bash_login

bind '"\t":menu-complete'