2

如何防止插件在命令行 vim 中加载,但允许它在 gvim 中加载?

我正在尝试使用gitgutter,它的顶部有这些行:

    if exists('g:loaded_gitgutter') || !executable('git') ||  !has("gui_running") || &cp
       finish
    endif

但是,每次我在启用 git 的目录中的命令行上启动 vim 时,都会得到所有这些垃圾:

"plugin/gitgutter.vim" 416L, 11964C
Error detected while processing function GitGutter..<SNR>35_init..<SNR>35_define_signs:
line    7:
E319: Sorry, the command is not available in this version:     sign define GitGutterLineAdded           text=+  texthl=lineAdded    linehl=NONE
line    8:
E319: Sorry, the command is not available in this version:     sign define GitGutterLineModified        text=~  texthl=lineModified linehl=NONE
line    9:
E319: Sorry, the command is not available in this version:     sign define GitGutterLineRemoved         text=_  texthl=lineRemoved  linehl=NONE
line   10:
E319: Sorry, the command is not available in this version:     sign define GitGutterLineModifiedRemoved text=~_ texthl=lineModified linehl=NONE
Error detected while processing function GitGutter..<SNR>35_find_other_signs:
line    2:
E319: Sorry, the command is not available in this version: :sign place file=/Users/adam/.vim/plugin/gitgutter.vim
Error detected while processing function GitGutter..<SNR>35_show_signs..<SNR>35_add_sign:
line    3:
E319: Sorry, the command is not available in this version: :sign place 3000 line=1 name=GitGutterLineModified file=/Users/adam/.vim/plugin/gitgutter.vim

我究竟做错了什么?

编辑:我的问题有些无效 - 结果是,我编辑的if语句既正确又有效,但是在我的 bundle/ 目录中有一个 gitgutter 副本正在加载代替plugin/gitgutter.vim

4

1 回答 1

1

你应该测试has('signs')而不是has('gui_running')

:h +signs
于 2013-03-22T17:04:20.293 回答