I've mentioned vimgrep in a previous post, but I neglected to mention a few useful flags that can be used in conjunction with it.
If you apply the 'g' flag to your vimgrep, it will return all matches instead of just one match per line.
:vimgrep /foo/g **/*
If you apply the 'j' flag, Vim will not automatically jump to the first match.
:vimgrep /foo/j **/*
Thanks to Chanel for pointing these out.
Wednesday, December 9, 2009
Subscribe to:
Post Comments (Atom)
7 comments:
Thank you, :vimgrep with :cope are great features :-)
:vimgrep wants a filename. If you just want to search in the current buffer use '%'. e.g. :vimgrep /foo/ %
@Charles
Doh, typo. Thanks for the heads up.
:lvimgrep may be more handy in many cases; i find it totally useful with C, when it uses location list instead of quickfix list, so the grep results don't get cleared every time i re-compile.
still, :lope, :cope, :vimgrep or :lvimgrep are totally powerful and handy :)
Thanks, useful stuff for a beginner. Didn't knew about :vimgrep feature. Keep the good work mate :)
Vimgrep Tips? Wow it could be perfect for me because I don't know much about it, but I want to increase my knowledge thanks.
heynow, this is the most recent "Daily Vim" post? I want my daily dose of vim coolness! :)
Post a Comment