On 09/26/2011 05:10 AM, David Fishburn wrote:
Vim 7.3.1-315

unnamedplus A variant of "unnamed" flag which 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.
Only available with the |+X11| feature.
Availability can be checked with: >
if has('unnamedplus')

So if I read that correctly, when using unnamedplus all yank operations
should use the '*' register and not the '+' register.

The register contents behaviour I see is also correct (will demonstrate
below).

But what appears to be wrong is the value of v:register.

gvim -u NONE -U NONE --noplugin -N

Create a new buffer with the following lines:
1
2
3
4
5

:set clipboard=
:echo v:register
"

Go to first line, yy
:echo v:register
"
:echo @"
1

Go to 2nd line, "ayy
:echo v:register
a
:echo @"
2
:echo @a
2


Good.


:set clipboard=unnamedplus
:echo v:register
+
Go to 3rd line, yy
:echo v:register
+
:echo @"
3
:echo @+
Something else
:echo @*
Something else


Go to 4th line, dd
:echo v:register
+
:echo @"
4
:echo @+
4
:echo @*
4



So, referring back to the text again:
unnamedplus A variant of "unnamed" flag which 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.


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

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