cygwin 文件路径选项卡完成功能不起作用
如何设置 Cygwin 来完成制表符?
实际上,我确实自动拥有它,但它似乎没有完成路径。如何设置它以完成路径?
How can I set up Cygwin to have tab completion?
Actually, I do have it automatically, but it does not seem to complete paths. How do I set it up to complete paths?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Cygwin 路径通常以
/cygdrive/c
开头(当然,替换您碰巧使用的任何驱动器号)。因此,要完成c:\Program Files
,您必须键入(例如)/cygdrive/c/Prog,然后按 TAB。另请注意,Cygwin 区分大小写,因此由于小写“p”,
/cygdrive/c/prog
不会完成为c:\Program Files
。Cygwin paths typically start with
/cygdrive/c
(substitute whatever drive letter you happen to be using, of course). So to completec:\Program Files
, you must type (for instance) /cygdrive/c/Prog and then press TAB.Also, note that Cygwin is case-sensitive, so
/cygdrive/c/prog
would not complete toc:\Program Files
due to the lowercase 'p'.我回答这个问题是因为自从之前接受的答案以来答案似乎已经改变。
我刚刚安装了Cygwin,发现bash补全实际上是一个独特且独立的安装模块“bash-completion”。默认安装中未选择它,因此您需要明确安装/更新它。
I'm answering this question because the answer seems to have changed since the previous accepted answer.
I just installed Cygwin, and found that the bash completion is in fact a distinct and separate installation module, "bash-completion". It is not selected in the default installation, so you need to install/update it explicitly.
cygwin 本身并不“具有”制表符补全功能;这是您正在使用的shell。默认情况下,cygwin shell 是 bash,它确实为路径上的可执行文件和当前目录中的文件提供基本的制表符补全。这对你不起作用吗?
It's not cygwin per se that "has" tab completion; it's the shell you're using. By default, the cygwin shell is bash, which does indeed provide basic tab completion for executables on your path and files in the current directory. Does it not work for you?
Cygwin 只是一个环境;与您交互的程序称为 shell。有许多 shell - bash、zsh 等等。
对于 bash,我找到了这套说明来修改您的 .inputrc 文件。
Cygwin is just an environment; the program you're interacting with is called the shell. There are many shells - bash, zsh, and others.
For bash, I've found this set of instructions to modify your .inputrc file.
每次我在新系统上安装 Cygwin 时,我都无法按照我想要的方式完成制表符补全,即用每个 TAB 笔划滚动完成结果,而不是列出潜在的结果和要求我继续输入,直到找到一个唯一可以通过按 TAB 键完成的输入。
让它滚动浏览有效结果的方法是将以下命令字符串放入您的
~/.bashrc
文件中:Every time I install Cygwin on a new system, I have trouble getting tab completion to work the way I want it to, which is to scroll through the completion results with each TAB stroke rather than listing potential results and requiring that I continue until typing until finding a unique one that will actually complete with a TAB press.
The way to get it to scroll through valid results is to place the following command string in your
~/.bashrc
file: