防止 vim grep 打开第一个匹配的文件
所以,摆弄 EasyGrep.vim 插件,试图让它进入适合我的状态。 我用它来递归搜索 Rails 项目。我几乎已经得到了我想要的结果,这是我修改后的 EasyGrep 执行的 grep 命令的示例:
:grep -R -i --include=*.rb --include=*.rbw --include=*.gem --include=*.gemspec --include=[rR]akefile --include=*.erb --include=*.rhtml SEARCH_WORD .
它找到光标下的单词,并在快速列表中打开搜索结果。
唯一的问题是, :grep 似乎会自动打开包含当前缓冲区中第一个匹配项的文件,我不希望它这样做,因为那样我就会丢失我刚刚查看的文件。
有人知道我该如何防止这种行为吗?或者,至少有一个巧妙的解决方法可以重新打开我正在搜索的文件?
:vimgrep 不是一个选择 - 它太慢了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自
:help :grep
:来自
:help :make
:因此:
:grep!
From
:help :grep
:From
:help :make
:So:
:grep!
将其添加到您的 .vimrc:
EasyGrep 有许多选项可以控制其行为方式。输入
:GrepOptions
以获得所有这些选项的列表。Add this to your .vimrc:
EasyGrep has many options that can control how it behave. Type
:GrepOptions
for a listing of all of these.