On 09/27/2011 04:40 AM, David Fishburn wrote:
...
If the + and * registers are not modified by yank operations, then
shouldn't v:register = " when yanking text (3rd line in the above
sample). Since @+ is not modified at all.
:help v:register mentions nothing about the *effective register*, only
the one supplied (and since 7.3.186, this considers the changed
default for the "unnamed" and "unnamedplus" values).
v:register The name of the register supplied to the last normal
mode command. Empty if none were supplied. |getreg()| |setreg()|
In my understanding, v:register is mainly necessary for custom
operations that work with registers, not for built-in commands like
yank. Is your inquiry about theoretical correctness, or do you have an
actual use case that is affected by this? In the latter case, I would
agree that v:register should account for the yank command. (But I
don't know how easy that would be to implement.)
Then YankRing plugin
(http://www.vim.org/scripts/script.php?script_id=1234) relies upon
v:register to determine:
a) which register to capture changes from
b) which register to update when retrieving the next value (from the
ring) for pasting
Unfortunately, there really is no work around for it either.
I could choose "+yy, or in this case yy. There is no way to
distinguish those commands.
True. There's no way to differentiate between an explicitly specified
unnamed register (""yy) and Vim defaulting to it (yy). For that, another
variable (e.g. v:register0, like the distinction between v:count and
v:count1) would be needed, or, as previously suggested, v:register
should account for the yank command.
While trying to implement the latter (which should be a matter of just
calling set_reg_var(0) in the special yank case), I've started to doubt
your interpretation of the "unnamedplus" help.
... uses the clipboard register '+' (|quoteplus|) instead of register
'*' for all operations except yank. Yank shall copy the text into
register '+' and also into '*' when "unnamed" is included.
Looking at the source and based on my own experiments, deletes _and_
yanks will go to register + with "unnamedplus". With
"unnamed,unnamedplus", yanks will _additionally_ go into register *, as
well as to register +. This also makes more sense to me from a usage
point of view than your interpretation.
However, this is at odds with the steps given in your initial message.
I'm currently on vacation and restricted to my wife's Ubuntu laptop, so
I'm not 100% confident about my own findings.
Could you please verify this once more? Maybe this isn't an issue at
all, just "user confused" :-)
-- 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