Tuesday, July 8, 2014

Re: [BUG?] redir tromping yank register 0?

Urtica Dioica wrote:

> Let's set up a 2-line file:
>
> hello
> world
>
> and have fun with the q command. You need to restart Vim before every example.
>
> q"~q
>
> :di reveals ~ has been written to "" and "0, which isn't that unusual.
>
> ddq"~q
>
> "" still matches "1, and q" only wrote to "0. That's odd.
>
> ddq1~q
>
> This wrote to "" and "1, but "0 is untouched.
>
> The "" register behaves differently depending on whether you use
> delete/yank, :redir, :let, or q. (Am I missing any?) I don't know the
> internals, but I think of it as a pointer to the register the text is
> actually in. It has a special affinity for "0.

Something else happens: You record to the register you specify. The ""
register points to the last used yank or delete register, recording does
not change it. Thus if you happen to record to the register the ""
points to, then "" is also changed.

--
Q: How do you tell the difference between a female cat and a male cat?
A: You ask it a question and if HE answers, it's a male but, if SHE
answers, it's a female.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: