我找到了这个git grep vim插件,但我无法弄清楚如何映射我的Command-Shift-F来调用它。我已经禁用默认出现的Ack插件。Janus Vim:重新映射Command-Shift-F到git grep
https://github.com/tjennings/git-grep-vim/
我找到了这个git grep vim插件,但我无法弄清楚如何映射我的Command-Shift-F来调用它。我已经禁用默认出现的Ack插件。Janus Vim:重新映射Command-Shift-F到git grep
https://github.com/tjennings/git-grep-vim/
你只需要创建一个调用GitGrep
命令自定义映射:
nnoremap <D-S-f> :GitGrep<Space>
之后,击中<D-S-f>
会把
:GitGrep | <-- cursor here
在命令行,准备好接受争论。
但我建议你选择一个更好的捷径:<D-S-f>
只适用于MacVim。即使在那里,我似乎还记得像这样的关键组合不是真的工作。 MacVim没有投诉,但<D-S-f>
在某种程度上与<D-f>
相同。 IIRC,您必须映射<D-F>
而不是<D-S-f>
。
像,f
这样的东西会更合适,我相信,更便携。
Janus已经包含绝对可怕的vim-fugitive,它也提供了:Ggrep
命令。
所以,我们可以通过破解方式Janus adds mapping for Ack。
首先禁用Ack
插件,在~/.vimrc.before
像这样:
call janus#disable_plugin('ack')
然后在你~/.vimrc.after
只是追加下面的代码:
if has("gui_macvim") && has("gui_running") " Command-Shift-F on OSX call janus#add_mapping('ggrep', 'map', '', ':Ggrep') else " Define to a dummy value to see if it would set as well. map :dummy if maparg("") == ":dummy" " f on systems where == call janus#add_mapping('ggrep', 'map', 'f', ':Ggrep') else " if we can still map to call janus#add_mapping('ggrep', 'map', '', ':Ggrep') endif map endif
享受!