如何使cygwin自动完成窗口路径?

时间:2022-11-15 16:26:18

I don't want to type /cygdrive/c/path/to/stuff, especially when using tools that don't know anything about cygwin. Is there a way to configure cygwin to autocomplete "c:\path\to\stuff" or even "c:/path/to/stuff"?

我不想输入/ cygdrive / c / path / to / stuff,特别是在使用对cygwin一无所知的工具时。有没有办法配置cygwin自动完成“c:\ path \ to \ stuff”甚至“c:/ path / to / stuff”?

4 个解决方案

#1


For tools that can't understand cygwin paths, you'll need to convert them to windows paths. The cygpath utility can do this for you:

对于无法理解cygwin路径的工具,您需要将它们转换为Windows路径。 cygpath实用程序可以为您执行此操作:

notepad $(cygpath -w /cygdrive/c/path/to/stuff)

You can probably create aliases or wrapper scripts for commonly-used windows executables.

您可以为常用的Windows可执行文件创建别名或包装脚本。

#2


Autocomplete should be working after the /cygdrive/c bit. Make a symlink for "/cygdrive/c/" to something else, like "ln -s /cygdrive/c /c". Also, make sure your inputrc is set up correctly.

自动完成应该在/ cygdrive / c位之后工作。将“/ cygdrive / c /”的符号链接设置为其他内容,例如“ln -s / cygdrive / c / c”。另外,请确保您的inputrc设置正确。

#3


Windows itself can autocomplete paths, with some minor registry tweaks. Or am I missing something in this question?

Windows本身可以自动完成路径,并进行一些小的注册表调整。或者我在这个问题上遗漏了什么?

#4


use alias:

Open the .bashrc file already copied in your home directory and type (I use "vi" editor for this but you can use "pico" which is a bit easier):

打开已在主目录中复制的.bashrc文件并键入(我使用“vi”编辑器,但你可以使用“pico”,这有点容易):

alias C="C:\Documents\ and\ Settings\Administrator"

you can use any path here. Save the .bashrc ("Ctrl+X" in pico I think, and :wq in "vi") and close the terminal. After restarting this console, typing "C" and pressing enter will send you automatically to "C:\Documents and Settings\Administrator"

你可以在这里使用任何路径。保存.bashrc(我认为pico中的“Ctrl + X”,以及“vi”中的wq)并关闭终端。重新启动此控制台后,键入“C”并按Enter将自动发送到“C:\ Documents and Settings \ Administrator”

To know which alias you have, just type "alias" in your terminal and all your alias will show up.

要知道您拥有哪个别名,只需在终端中输入“别名”,您的所有别名都会显示出来。

#1


For tools that can't understand cygwin paths, you'll need to convert them to windows paths. The cygpath utility can do this for you:

对于无法理解cygwin路径的工具,您需要将它们转换为Windows路径。 cygpath实用程序可以为您执行此操作:

notepad $(cygpath -w /cygdrive/c/path/to/stuff)

You can probably create aliases or wrapper scripts for commonly-used windows executables.

您可以为常用的Windows可执行文件创建别名或包装脚本。

#2


Autocomplete should be working after the /cygdrive/c bit. Make a symlink for "/cygdrive/c/" to something else, like "ln -s /cygdrive/c /c". Also, make sure your inputrc is set up correctly.

自动完成应该在/ cygdrive / c位之后工作。将“/ cygdrive / c /”的符号链接设置为其他内容,例如“ln -s / cygdrive / c / c”。另外,请确保您的inputrc设置正确。

#3


Windows itself can autocomplete paths, with some minor registry tweaks. Or am I missing something in this question?

Windows本身可以自动完成路径,并进行一些小的注册表调整。或者我在这个问题上遗漏了什么?

#4


use alias:

Open the .bashrc file already copied in your home directory and type (I use "vi" editor for this but you can use "pico" which is a bit easier):

打开已在主目录中复制的.bashrc文件并键入(我使用“vi”编辑器,但你可以使用“pico”,这有点容易):

alias C="C:\Documents\ and\ Settings\Administrator"

you can use any path here. Save the .bashrc ("Ctrl+X" in pico I think, and :wq in "vi") and close the terminal. After restarting this console, typing "C" and pressing enter will send you automatically to "C:\Documents and Settings\Administrator"

你可以在这里使用任何路径。保存.bashrc(我认为pico中的“Ctrl + X”,以及“vi”中的wq)并关闭终端。重新启动此控制台后,键入“C”并按Enter将自动发送到“C:\ Documents and Settings \ Administrator”

To know which alias you have, just type "alias" in your terminal and all your alias will show up.

要知道您拥有哪个别名,只需在终端中输入“别名”,您的所有别名都会显示出来。