I'm attemping to call a function when pressing y + motion like this in my vimrc:
function! s:MyFunction(reg) echo a:reg endfunction nnoremap y :<C-U> call <SID>MyFunction(v:register)<CR>y
When I type "ayw, MyFunction echoes
'a' like expected, but the yanked word is never written to register
"a, instead it is written to the yank register
Why and how to fix this so my mapping honors the specified named register?