mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
Add Delete Lines That Match A Pattern as a vim til.
This commit is contained in:
15
vim/delete-lines-that-match-a-pattern.md
Normal file
15
vim/delete-lines-that-match-a-pattern.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Delete Lines That Match A Pattern
|
||||
|
||||
The `:g` command can be used to execute an Ex command over the entire buffer
|
||||
for all lines that match a given pattern. By choosing `d` (delete) as the Ex
|
||||
command, all lines that match the given pattern will be deleted. For
|
||||
instance, if I want to remove all lines that contain `binding.pry`, I can
|
||||
execute the following command:
|
||||
|
||||
```
|
||||
:g/binding\.pry/d
|
||||
```
|
||||
|
||||
See `:h :g` for more details.
|
||||
|
||||
h/t Chris Erin
|
||||
Reference in New Issue
Block a user