I actually combined input from both Tim and Ben and came up with a hybrid solution. It uses a global command and redirect lines into a new file and goes like this:
:redir @* |g/cat/sil! -3,+4 |redir END | redir >> results.txt
Such solution will find all lines where "cat" is mentioned and copy a block of lines starting from 3 lines above and 4 lines below. The result is placed into a file named "results.txt". I like one liner solutions and this works faster on larger files.
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php