Variables of scripts go away with autocmd?

210 views Asked by At

I tried this in .vimrc (which uses vundle):

autocmd FileType python Bundle 'ervandew/supertab'

and 'ervandew/supertab' also lists in 'BundleList` in a python file. It doesn't work. I don't know why. Maybe my autocmd command was wrong?

I suspect the assignments are going away. When I do just Bundle 'ervandew/supertab', I can see variables in vim. For example :let SuperTabMappingForward shows SuperTabMappingForward <tab>. But with autocmd, I get E121: Undefined variable: SuperTabMappingForward. I get the same when I put Bundle 'ervandew/supertab' in ~/.vim/ftplugin/python.vim

My vim knowledge in limited!

1

There are 1 answers

1
Ingo Karkat On

The :Bundle command is meant to be put into your ~/.vimrc, which is executed before all other initializations. Those won't run automatically when you later issue the :Bundle command.

So, you'll need to add at least

:autocmd FileType python runtime! plugin/supertab.vim

to run the plugin initialization. (And then, those variables should show up, too!)

critique

I'd recommend against such dynamic plugin loads. Do you do them to speed up Vim startup? Do you really only want a general-purpose plugin like SuperTab loaded for Python files?!