On Fri, June 15, 2012 09:57, Nick Shyrokovskiy wrote: > On Friday, June 15, 2012 8:32:44 AM UTC+3, Christian Brabandt wrote: > >> Do you mean, you see something different, than what is redirected? >> I can't reproduce this. > I'll give an example. > > Say initially I have a buffer: > > --buffer-- > a1 > a2 > --------- > > if i sequentially issue: > :redir @c > :g/a./ > :redir END > :put c > > I'll get and i'll see 2 matched lines in vim output as :g is not silent > --buffer-- > a1 > a2 > > > a1 > a2 > ---------- > > but if issue: > :redir @c | g/a./ | redir END > :put c > I'll see somewhat different vim output but again 2 matched lines, but the > buffer will be > --buffer-- > a1 > a2 > > a1 > ---------- > > Once again if I issue: > :redir @c | g/a./ | redir END | put c > that's what I'll get in buffer, output is OK again > --buffer-- > a1 > > a1 > a2 > > a1
Your problem is, the :redir END part is seen as argument to the :g command, that is, for each matching line, the :redir END command is issued and therefore you only get the first match in your register. To prevent this, you can use :exe if you want to put this in one single line, e.g. :redir @c|exe "g/a./"|redir END See :h :bar :h :exe regards, Christian -- 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
