防止vim grep打开第一个匹配文件 [英] prevent vim grep from opening first matching file
问题描述
我正在使用它来递归搜索Rails项目。我几乎已经知道了它的样子,这是我修改的EasyGrep执行的grep命令的一个例子:
:grep -R -i --include = *。rb --include = *。rbw --include = *。gem --include = *。gemspec --include = [rR] akefile --include = *。erb --include = * .rhtml SEARCH_WORD。
在光标下找到该单词,并在快速列表中打开搜索结果。
唯一的问题是,:grep似乎会自动将包含第一个匹配项的文件打开到当前缓冲区中,而我不希望它做,因为然后我失去了我刚才看到的文件。
任何人都知道我可以如何防止这种行为?或者,至少有一个hacky解决方法,重新打开我搜索的文件?
:vimgrep不是一个选项 - 它太慢了。
就像:make,但是使用'grepprg'而不是'makeprg'和'grepformat'而不是'errorformat'。
从:help:make
:
blockquote>
如果没有给出[!],那么第一个错误会跳到。
所以:
:grep!
So, fiddling 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!
这篇关于防止vim grep打开第一个匹配文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!