Copy search matches – Vim Tips Wiki

http://vim.wikia.com/wiki/Copy_search_matches#Copy_matches_or_lines

One I’m always having to look up:  find all lines with a pattern match within a file and copy them to the clipboard/a register.

qaq
:g/pattern/y A
:let @+ = @a

Leave a Reply

Your email address will not be published. Required fields are marked *