1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Delete Lines That Match A Pattern as a vim til.

This commit is contained in:
jbranchaud
2015-10-16 09:33:17 -05:00
parent 693bd12dbb
commit f5004fc21e
2 changed files with 16 additions and 0 deletions

View File

@@ -232,6 +232,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Count the Number of Matches](vim/count-the-number-of-matches.md)
- [Create A New Directory In netrw](vim/create-a-new-directory-in-netrw.md)
- [Create A New File In A New Directory](vim/create-a-new-file-in-a-new-directory.md)
- [Delete Lines That Match A Pattern](vim/delete-lines-that-match-a-pattern.md)
- [Deleting Directories Of Files From netrw](vim/deleting-directories-of-files-from-netrw.md)
- [Edges Of The Selection](vim/edges-of-the-selection.md)
- [End Of The Word](vim/end-of-the-word.md)

View 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