Given a file like this:
Roy
Maurice
Jen
Douglas
If I were to type the following commands: ggVj"zy
, followed by :reg z
, I would see Roy and Maurice.
Now I want to yank Jen and Douglas into the z
register, but by a different method. If I do: GVk:normal! "zy<CR>
(where <CR> is a key press of the Enter key, of course), the z
register remains unchanged. Even erasing the '<,'>
range modifiers after typing :
doesn't help.
The above is an easy way to show the problem. I'm implementing it in a function that I call with a vnoremap
key mapping:
function! Foo()
reg z " show before
normal! "zy
reg z " show after
endfunction
So why is my normal! "zy
statement not working? Is there something I've missed or misunderstood?
:[range]yank z
. If you have a range, it could be:'<,'>y z