Skip to content

Commit f5004fc

Browse files
committed
Add Delete Lines That Match A Pattern as a vim til.
1 parent 693bd12 commit f5004fc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
232232
- [Count the Number of Matches](vim/count-the-number-of-matches.md)
233233
- [Create A New Directory In netrw](vim/create-a-new-directory-in-netrw.md)
234234
- [Create A New File In A New Directory](vim/create-a-new-file-in-a-new-directory.md)
235+
- [Delete Lines That Match A Pattern](vim/delete-lines-that-match-a-pattern.md)
235236
- [Deleting Directories Of Files From netrw](vim/deleting-directories-of-files-from-netrw.md)
236237
- [Edges Of The Selection](vim/edges-of-the-selection.md)
237238
- [End Of The Word](vim/end-of-the-word.md)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Delete Lines That Match A Pattern
2+
3+
The `:g` command can be used to execute an Ex command over the entire buffer
4+
for all lines that match a given pattern. By choosing `d` (delete) as the Ex
5+
command, all lines that match the given pattern will be deleted. For
6+
instance, if I want to remove all lines that contain `binding.pry`, I can
7+
execute the following command:
8+
9+
```
10+
:g/binding\.pry/d
11+
```
12+
13+
See `:h :g` for more details.
14+
15+
h/t Chris Erin

0 commit comments

Comments
 (0)