Hello Vim developers,

In a plugin, I want to avoid that a :put =var command clobbers the expression
register, so I save this via getreg('=', 1). I realized that I couldn't use
setreg() to restore the expression register, but assignment via :let @= = var
works just fine. Is this disallowed for setreg() because both the "append to
register" functionality and the regtype argument don't make sense here?

I think it would be helpful to hint at the possibility of using :let @=;
otherwise, people might assume that restoring the expression register value
isn't possible at all.

diff -r c0ac5ba66243 runtime/doc/eval.txt
--- a/runtime/doc/eval.txt      Wed Aug 29 18:50:54 2012 +0200
+++ b/runtime/doc/eval.txt      Sun Sep 02 14:38:27 2012 +0200
@@ -5253,8 +5253,9 @@

                If {options} contains no register settings, then the default
                is to use character mode unless {value} ends in a <NL>.
-               Setting the '=' register is not possible.
-               Returns zero for success, non-zero for failure.
+               Setting the '=' register is not possible, but you can use >
+                       :let @= = var_expr
+<              Returns zero for success, non-zero for failure.

                Examples: >
                        :call setreg(v:register, @*)

-- regards, ingo

-- 
  -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
  --      http://vim.sourceforge.net/account/profile.php?user_id=9713    --

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