I'm using Pathogen to set up bundles in vim. One such bundle I use is vdebug. I want to set vdebug so it doesn't have a "server" option by default. Within vim, I can do that with either one of
VdebugOpt server ""
let g:vdebug_options['server'] = ""
But if I set one of those commands in my ~/.vimrc, when I first start vim it fails. Here's a very simple .vimrc that reproduces the problem:
execute pathogen#infect()
syntax on
filetype plugin indent on
call pathogen#helptags()
VdebugOpt server ""
With that, I get
Error detected while processing /home/editor/.vimrc:
line 5:
E492: Not an editor command: VdebugOpt server ""
Or, if I change the last line to
let g:vdebug_options['server'] = ''
I get
Error detected while processing /home/editor/.vimrc:
line 5:
E121: Undefined variable: g:vdebug_options
But once vim is started, either one of those commands works. What is going on to cause this discrepancy, and how can I set the default I want for vim on startup?
You can see in :h initialization
that Vim will, at startup, run .vimrc
(step 3), then run plugins (step 4). VdebugOpt
is simply not defined in .vimrc
, nor is g:vdebug_options
(so you can't add a new option).
However, you can define g:vdebug_options
:
let g:vdebug_options = {
\ 'server' = ''
\ }
or equivalently
let g:vdebug_options = {}
let g:vdebug_options['server'] = ''