On Wednesday, April 5, 2017 at 9:47:21 PM UTC+3, Bram Moolenaar wrote:
> Ramel Eshed wrote:
> 
> > > > vim -u NONE
> > > > 
> > > > ia<C-R>="b\n"<CR>
> > > > 
> > > > results:
> > > > ab
> > > > <empty line>
> > > > 
> > > > This should be the expected behavior as I understand. But if I use 
> > > > instead:
> > > > ia<C-R><C-O>="b\n"<CR>
> > > > 
> > > > I get:
> > > > b
> > > > a
> > > > 
> > > > Also:
> > > > 
> > > > ia<C-R><C-R>="b\n"<CR>
> > > > I get:
> > > > ab^@
> > > > 
> > > > -the ^@ is displayed instead of an empty new line.
> > > > 
> > > > I'm using vim 8.0.540 on RHEL6. Please look into it.
> > > 
> > > Vim offers those different commands to be able to insert different
> > > things.  So it's normal that they work differently.
> > > 
> > > On top of that, it appears that in the second case the register is
> > > recognized as linewise, since the text ends in a NL.
> > > 
> > 
> > Hi Bram,
> > 
> > I'm aware to the differences between these commands. According to the 
> > documentation both <C-R><C-R> and <C-R><C-O> insert the text literally and 
> > the only difference is if the formatting options are used or not. I don't 
> > see how formatting is related to my example or why one command uses a 
> > linewise register while the other is not.
> > 
> > Also, I'm not sure if this is related, but I noticed that the results of 
> > the following two sequences are different:
> > 1) ia<C-R><C-R>="b\n"<CR>
> > 2) let @b="b\n"
> >    ia<C-R><C-R>b
> 
> Yes, the first one evaluates an expression and inserts the result.  The
> second one assigns an expression to a register, where the trailing NL
> causes it to become linewise.  An expression itself is just a string,
> a register can be linewise.

Ok, but still why <C-R><C-O> considers the above b register (let @b="b\n") 
linewise while <C-R><C-R> not?

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

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

Raspunde prin e-mail lui