vimgrep

how to open multiple files in vim after vimgrep

I'm using gvim. Using vimgrep on current directory to find text across *.sql files. As it searches files, it just shows me file name at a time and in the end opens one file up. Is it possible to open all files as tabs? Basically I want to open all files because I want to replace the 'vimgrepped' pattern with a some other text. ...

How to make vimgrep do word match search?

I have below statement in _vimrc file to map F3 to do vimgrep for word under current cursor. map <F3> :execute "noautocmd vimgrep /" . expand("<cword>") . "/gj **/*." . expand("%:e") <Bar> cw<CR> Now, I want to make it vimgrep for exact word match for word under current cursor. I changed it as below but it doesn't work. map <leader>...

How to exclude file patterns in vimgrep?

In vim, I do search with vimgrep frequently. I have mapping like below: map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar> cw<CR> 5 The problem is that there are some temporary subfolders (like obj, objd) that I don't want to search for. How can I exclude subfolders matching given patterns. Fo...

How do I write a vim function that calls VimGrep?

I want to write a function myFunc such that: myFunc /function foo/ becomes :vimgrep /function foo/ **/*.cpp **/*.hpp and myFunc /class bar: public/ becomes vimgrep /class bar: public/ **/*.cpp **/*.hpp how do I do this? Thanks! ...

vimgrep, :cn and n

I'm reading through a large C++ code base in Vim. Within a single file, I can do /foo n n n Now, if I want to search through more than one file, I have to do: :vimgrep /foo/ :cn :cn :cn Now, typing ":cn" is so much less convenient than "n". Is there a way to search through vimgrep results with "n" (like searches with /) instead of...

Vim, vimgrep, and file caching

My entire source code base is < 20MB. I want it all loaded in memory in the background. So that when I do vimgrep */.cpp */.cxx */.hpp , it doesn't ahve to do file IO since vim has loaded all the files into memory already. How can I achieve this? Thakns! ...

My vimgrep search is not behaving as I would expect.

Hi, I am performing the following vimgrep search (in vim(!)).... :vimgrep /^\s*bool\s\+\i\+\s*=\s*\(false\)\|\(true\);\s*$/ *[files....]* in order to find bool variable initialisations in my code. It successfully returns all of the bool initialisations, e.g. bool result1 = false; bool result2=true; but it also returns other ...