On 04-Feb-2011 21:45, ZyX wrote:
> There is one compatibility problem for empty v:register value: constructs like
> 
>     execute "normal! \"".v:register."yy"
> 
> won't work. 

Good point. Actually, I was surprised that the following works even with an
empty v:register:
    execute 'echo @' . v:register

> there is another option: change documentation of v:register to mention
> that it is always an effective register and add v:regspecified
> variable.

Right, that's what I proposed:

-v:register     The name of the register supplied to the last normal mode
-               command.  Empty if none were supplied. |getreg()| |setreg()|
+v:register     The name of the register in effect for the current normal mode
+               command (regardless of whether that command actually uses a
+               register). |getreg()| |setreg()|

I doubt that the need for a separate v:regspecified (or v:register0) variable
would be large enough to warrant it. I can see it for v:count vs. v:count1, but
here it would only foster misuse, i.e. using the specification or omission of a
register for something other that setting or getting that register in a mapping.
(But my script-writer self loves hacks like changing the meaning of a mapping
depending on whether is was invoked as X or ""X.)

-- regards, ingo

-- 
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

Raspunde prin e-mail lui