开发者

prevent vim grep from opening first matching file

So, f开发者_开发百科iddling with the EasyGrep.vim plugin, trying to get it into a state that suits me. I am using it for recursive searching of a Rails project. Ive almost got it how I want it, this is an example of the grep command my modified EasyGrep executes:

:grep -R -i  --include=*.rb --include=*.rbw --include=*.gem --include=*.gemspec --include=[rR]akefile --include=*.erb --include=*.rhtml SEARCH_WORD .

Which finds the word under the cursor, and opens the search results in quicklist.

Only problem is, :grep seems to automatically open the file containing the first match into the current buffer, which I do not want it to do, because then I lose the file I was just looking at.

Anyone know how I can prevent this behavior? Or, at least a hacky workaround that reopens the file I was searching from?

:vimgrep is not an option - its far too slow.


From :help :grep:

Just like ":make", but use 'grepprg' instead of 'makeprg' and 'grepformat' instead of 'errorformat'.

From :help :make:

If [!] is not given the first error is jumped to.

So: :grep!


Add this to your .vimrc:

    let g:EasyGrepOpenWindowOnMatch=0

EasyGrep has many options that can control how it behave. Type :GrepOptions for a listing of all of these.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜