Saturday, August 27, 2011

Re: How to apply a ex-cmd to all buffers currently displayed

Tim Chase <vim@tim.thechases.com> [11-08-27 13:20]:
> On 08/27/11 03:59, meino.cramer@gmx.de wrote:
> >I have the vimdiff of two files open.
> >
> >As the diffed lines of some kind are not interesting in the moment,
> >I want to g/<pattern>/d them out of the way on both windows.
> >
> >How can I apply the command to both, without entering the cmd
> >again and without affecting any othe buffer?
>
> Depends on how strictly you're using your vocabulary. If you only have
> two vim-windows open (as is typical with vimdiff), and your other
> buffers are just passively open (rather than visible in windows) then
> you can just use
>
> :windo g/<pattern>/d
>
> which I do regularly.
>
> If, however, you have more than the 2-3 diff windows open, you'd have
> to do something like
>
> :windo if &diff | exec 'g/<pattern>/d' | endif
>
> (the exec... is to prevent the :g command from eating the "|endif" as
> part of its command) to prevent the command from executing in other
> windows.
>
> Since that's ugly, you can also enter your first diff-buffer and
> execute your command as usual, then go to your other diff-buffer(s) and
> execute
>
> @:
>
> which executes the last Ex command again. Also something I use
> regularly.
>
> :help @:
> :help :windo
>
> Hope this helps,
>
> -tim
>
>
>
> --
> 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
>

Hi Tim,

YES!YES!YES! IT HELPS ME! :)))

Thank you very much!

Have a nice weekend!
Best regards,
mcc

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

No comments:

Post a Comment