I think I understand the problem, or at least one problem. To give an example,
vim-pasta does something like this:
exe "nmap <buffer> " . g:pasta_paste_before_mapping . " <Plug>BeforePasta"
nnoremap <silent> <Plug>BeforePasta :<C-U>call <SID>NormalPasta('P',
'O')<CR>
function! s:NormalPasta(p, o)
" ...
exe "normal! " . a:o . "\<space>\<bs>\<esc>" . v:count1 . '"' .
v:register . ']p'
" ...
endfunction
With Christian's patch, it seems like this doesn't work. The plugin uses the
default register regardless of how I invoke the paste mapping. If I understand
what Ingo's saying, any normal-mode command, including :, should clear
v:register. If this is what Christian's patch is doing, it would explain why
v:register is lost in the above case. And I think it's a pretty common use case
to build up a <Plug> mapping by calling a command or function. In fact, if :
resets v:register, I'm not sure how it would even be possible to access that
variable in order to save it.
The way I *think* it should work is: Particular operators like d, y, p
"consume" a register. Once they're done, the v:register can safely be reset to
the default. As Ingo says, typing "xyy should reset v:register, but typing "x:
should not, since the register was just left hanging for the next operations.
At least that's how I see the "correct" functionality, but I'm starting to feel
pretty confused about edge cases. Can anybody say whether my line of thinking
is in the right direction?
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.