[英]Is there a VSCode shortcut or command similar to VIM for grepping lines?
Sometimes I need to look for lines that do not contain a string. 有时,我需要查找不包含字符串的行。 For example, on our Jenkins files, there's a lot of "Downloading $package".
例如,在我们的Jenkins文件中,有很多“下载$ package”。 I can copy the file into VIM and do a
:g/Downloading/d
and all lines that contain the word "Downloading" will be deleted. 我可以将文件复制到VIM并执行
:g/Downloading/d
,所有包含“ Downloading”一词的行都会被删除。
Is there something like that in VSCode? VSCode中有类似的东西吗?
If you install the vscodevim and enable the Neovim setting(below), you will be able to use :g functionality. 如果安装vscodevim并启用Neovim设置(如下所示),则可以使用:g功能。
"vim.enableNeovim": true “ vim.enableNeovim”:是
VS Code supports regexp in find, and it even supports a kind of inverse matching. VS Code在查找中支持正则表达式,甚至还支持一种逆匹配。
In your case you can enable regexp in the "Find..." box (the button with the ".*" symbol) and use ^((?!Downloading).)*$
to match all lines that do not contain the string "Downloading". 在您的情况下,您可以在“查找...”框中启用正则表达式(带有“。*”符号的按钮),并使用
^((?!Downloading).)*$
来匹配所有不包含字符串的行“下载”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.