I keep my VIM folder under git version control. I use git submodules and Pathogen to keep my VIM plugins updated. The folder structure is .vim/bundle/$PLUGIN

Is it possible to use git submodules for syntax files? With plugins this works because each plugin corresponds to the submodule repository in its own folder. As far as I can tell syntax files cannot be in sub-folders (arising from the cloned git submodule repository) within .vim/syntax and this approach breaks down.

Is there any way to resolve this?

  • I would consider syntax files not shipped with Vim (which are not minor adjustments kept in an after directory) to be syntax plugins. You should be able to load them the way you do other plugins. Are you using Pathogen? – jjaderberg Sep 2 '16 at 15:22
  • Oops, yes, I meant pathogen when I wrote bundle. Can you elaborate on "You should be able to load them the way you do other plugins."? Thanks! – Matthias Schlaipfer Sep 2 '16 at 15:46
  • This vim (syntax) plugin has a pathogen installation example: github.com/octol/vim-cpp-enhanced-highlight - so you basically install it similar to other plugins. – VanLaser Sep 2 '16 at 21:24

Plugin managers like Pathogen add each subdirectory of .vim/bundle/ to the 'runtimepath'. If a syntax plugin has the proper syntax/foo.vim (or after/syntax/foo.vim) structure in its repository, it will work just like regular plugins (which need to use the plugin/ and autoload/ subdirs).

You can use the :scriptnames command to see what Vim actually loaded, and check the runtimepath via :set rtp?

| improve this answer | |
  • Thanks, this works! Unfortunately my score is too low to up-vote as well. – Matthias Schlaipfer Sep 5 '16 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.