In a file, I want to be able to delete context around a search pattern.
By context I mean: a) 'n' lines before the pattern b) 'n' lines after the pattern c) 'n' lines after and before the pattern d) do a,b,c by deleting the pattern line as well e) do a,b,c without deleting the pattern line
Is there some way to do it using :g/
or :%s
or some other way?
I can do this with macros, but that's not what I am looking for.
Here is sample text:
search_pattern random text 1
line below search pattern(delete me)
abc def
pqr stu
...
line above search pattern(delete me)
search_pattern random text 2
line below search pattern(delete me)
...