keflavich
keflavich

Reputation: 19235

Plugins for gvim only?

How do you prevent a plugin from loading in command-line vim, but allow it to load in gvim?

I'm trying to use gitgutter, which has these lines at the top:

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

However, every time I start up vim on the command line in a git-enabled directory, I get all this junk:

"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

What am I doing wrong?

EDIT: My question was somewhat invalid - turns out, my edited if statement was both correct and worked, BUT there was a copy of gitgutter in my bundle/ directory that was loading in place of the plugin/gitgutter.vim

Upvotes: 2

Views: 384

Answers (1)

Luc Hermitte
Luc Hermitte

Reputation: 32966

You should be testing has('signs') and not has('gui_running')

:h +signs

Upvotes: 1

Related Questions