On 26/09/11 14:41, Ingo Karkat wrote:
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()|
That text is obsolete; it was changed in changeset b6471224d2af dated 9
February and again in changeset 3c7da93eb7f9 dated 10 May. The current
text is as follows:
*v:register* *register-variable*
v:register The name of the register in effect for the current normal mode
command. If none is supplied it is the default register '"',
unless 'clipboard' contains "unnamed" or "unnamedplus", then
it is '*' or '+'.
Also see |getreg()| and |setreg()|
Note that the text speaks of "the register in effect for the current
normal-mode command". When not in a normal-mode command (as with :echo)
the value is unspecified. A strict interpretation of the above text
implies that the only place where you could actually examine the value
of v:register and get a meaningful result would be in the {rhs} of a
Normal, Visual or Operator-Pending mapping (preferably with the <expr>
modifier). However if the meaning is extended to ex-commands which
accept a register argument it might have a value (inaccessible to the
user) during :put, :delete or :yank, and an accessible value during
execution of a user-command defined with the -register modifier.
Anywhere else than the two above cases (mapping and user-command) I
wouldn't rely on this variable having any meaningful value.
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
Best regards,
Tony.
--
Champagne don't make me lazy.
Cocaine don't drive me crazy.
Ain't nobody's business but my own.
-- Taj Mahal
--
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