Thursday, December 18, 2014

How to use bufdo?

So I just learned about a cool new command called 'bufdo' where you
can execute a command across multiple buffers. Unfortunately, I can't
quite get it to work.
I've got 2 buffers open side by side (this is output I've piped to vi,
so it's not saved in any file) and I want to grep for "somestring" in
both.

:bufdo !grep somestring

It breaks out of vi with a message
"[No write since last change]"

After hitting enter/ctrl+c a couple of times, I'm back into vi, but
nothing's changed.
I don't want vi to save anything, I just want it to grep for the
matching lines in the 2 buffers I have open.

I tried playing around with these:
:set autowriteall
:set hidden

But that didn't work either...so how do a simple grep across buffers
without having to save?

Thanks,
Ven

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

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

No comments:

Post a Comment