I posted this a while ago on vim_use, but no response. It looks like
either a bug or a very misleading :help entry.

The thread is about how using :let-@ will automatically append a ^J
character if the text ends in ^M (useful for yanked text, but causes
unintended side effects when editing a recorded macro).

http://groups.google.com/group/vim_use/browse_thread/thread/fa96cad79cdfaadb/

---------- Forwarded message ----------
From: Ben Fritz <[email protected]>
Date: Tue, Jul 26, 2011 at 1:40 PM
Subject: Re: unexpected behavior of :let-@
To: vim_use <[email protected]>




On Jul 26, 12:57 pm, ZyX <[email protected]> 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_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