vim: Search, copy and paste to another file
First open the file, in which you want to search. At the prompt:
:vimgrep /<pattern>/ %
Display just the selected lines:
:copen
Yank all lines
:%y
Open another file within vim:
:e ~/my_results.log
Paste all the yanked lines here:
:p
Written by Sajnikanth Suriyanarayanan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#