简体   繁体   中英

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". I can copy the file into VIM and do a :g/Downloading/d and all lines that contain the word "Downloading" will be deleted.

Is there something like that in VSCode?

If you install the vscodevim and enable the Neovim setting(below), you will be able to use :g functionality.

"vim.enableNeovim": true

VS Code supports regexp in find, and it even supports a kind of inverse matching.

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM