Hi, Nick Shyrokovskiy wrote: > > 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 > ----------
the :global command takes all following commands and executes them for all matching lines. So what you are seeing here is that :global marks both for further processing and then prints the first line and stops redirection, then prints the second line and again stops (the already stopped) redirection. Effectively you are telling Vim to only capture the first line that matches the pattern after :global. > 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 > ---------- No, the output is not what you expected. Vim only captures the first line and puts it into the buffer twice. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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
