Tuesday, July 26, 2011

Re: unexpected behavior of :let-@

On Jul 26, 12:57 pm, ZyX <zyx....@gmail.com> wrote:
> Reply to message «unexpected behavior of :let-@»,
> sent 20:36:08 26 July 2011, Tuesday
> by Ben Fritz:
>
> Not related to documentation fix, but you can use `setreg()' to avoid this
> behavior.
>

Nice! I'd forgotten about setreg(), finding it completely unnecessary
after being pointed to :let-@. I guess I'll be revisiting it. I do see
that for it to work as I want, I need to explicitly give the 'c' flag
as the type.

:help setreg() indicates that you should be able to change the type of
a register which already has content:

You can also change the type of a register by appending
nothing:
:call setreg('a', '', 'al')

But, I tried:

:let @a='^M'
:reg a → ^M^J
:call setreg('a','','ac')
:reg a → ^M^J

Did I misunderstand how this is supposed to work? I would expect the
^J to be removed after changing the type.

--
You received this message from the "vim_use" 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

No comments:

Post a Comment