[英]How do I start VS Code from the terminal when I get `./MacOS/Electron: No such file or directory`?
[英]How do I open a file in VS Code terminal by partially matching the file name?
如果我有一个名为w5_align_example.cpp
的文件,如何仅通过提供align
一词在VS Code集成终端中打开该文件?
code w5_align_sample.cpp
会打开它,但是我有时只记得关键字align
除非我在单独的命令中搜索以查看文件的开头。 我想用一个命令打开。
我试过了:
$ ls | grep "align" | code
$ ls | grep "align" | code
这给了我Run with 'code -' to read output from another program (eg 'echo Hello World | code -').
错误。
$ ls | grep "align" | code -
$ ls | grep "align" | code -
打开一个名为code-stdin-sfd.txt
的新文件,其中包含文本w5_align_example.cpp
。
什么是最简单(即最短)的命令?
ls | grep "align" | xargs -I{} code {}
要么
code $(ls | grep "align")
您可以只使用*
。 它与任何字符串匹配,可以多次使用。
code *align*
在某些Shell中,您可以将其与制表符补全结合使用。 只需输入:
code *align*
然后按Tab 。 这将填写其余的文件名,但是如果有多个选项,它将发出蜂鸣声。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.