I'm trying to copy just the matches in my regex search to a register in VIM on windows.
That said, I found the following script for doing this:
function! CopyMatches(reg) let hits =  %s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/ge let reg = empty(a:reg) ? '+' : a:reg execute 'let @'.reg.' = join(hits, "\n") . "\n"' endfunction command! -register CopyMatches call CopyMatches(<q-reg>)
However, when I run the script and try to paste my matches from register a, it comes back blank. Is there something else that I need to do to make this work?