> 1. say I want to perform an action on all modified buffers. Like
> performing compress or just echo their name. how is it done?
> I read about bufdo and assume the answer lies in that direction.

You're right -- though the command you want to execute may have 
to be wrapped in an exec() call/statement.  It may also need to 
have 'hidden' set to allow you to leave the modified buffers:

   :set hidden
   :bufdo if &modified | some_ex_command | endif

where some_ex_command may require using exec as described at

   :help :bar

which lists the "problem" commands (those that eat following 
bars/pipes), as well as the example of using :execute

> 2. More complex. Say I want to execute a shell (bash) command on all
> buffers. For the buffers that the shell command succeeds (i.e. returns
> 0) perform some action. This can be useful for example to compress all
> files larger than a given size, checking in all checked-out source
> files  at the end of editing session etc.
> what I had in mind is something along the lines of:
> :silent bufdo !if test_cmd % > /dev/null ; then execute_desired_cmd
> % ; fi

Not sure on this one, but it looks fairly kosher.

-tim



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to