Friday, 23 March 2018

vim - Snipmate + Pathogen + Git - Custom Snippets don't work on Windows


Here is my setup:



  1. My .vim directory is under source control with git

  2. I use Pathogen for managing my plugins

  3. My SnipMate plugin is a git submodule under .vim/bundle/snipmate


This means I can't really edit the snippets in .vim/bundle/snipmate/snippets because they are not tracked. I have discovered that I can define my own custom snippets in .vim/snippets, or create a new directory .vim/bundle/snipmate-custom/snippets/ and define them there.


This works beautifully on linux. For example I can have the original file html.snippets in .vim/bundle/snipmate/snippets and my own html.snippets in .vim/snippets/ and vim will use both files.


On Windows I have noticed that creating another snippets directory (either in .vim/snippets/ or in .vim/bundle/snipmate-custom/snippets/ breaks the plugin. The tab completion no longer works - it ignores both the original snippets that came with the plugin, and the ones in the new repository.


Any idea why this is happening?


I'm running Vista, and I my vim config is in %USERPROFILE%\.vim. I have vimfiles folder symlinked to that directory using:


mklink /d vimfiles .vim


Every other plugin works. Shipmate works perfectly provided the .vim/snippets directory does not exist. The above setup works fine on Ubuntu and on Mac. Any idea why it breaks on Windows?


EDIT


I might have answered my own question. I managed to work around this problem by explicitly telling snipmate which directories to use:


   if has('win32')
let g:snippets_dir="c:/Users/me/.vim/bundle/snipmate/snippets/,
c:/Users/me/.vim/bundle/snipmate-custom/snippets"
endif

Not the most elegant solution, but it works. Let me know if you figure out a better way to do this.



Answer



I have answered my own question. I managed to work around this problem by explicitly telling snipmate which directories to use:


   if has('win32')
let g:snippets_dir="c:/Users/me/.vim/bundle/snipmate/snippets/,
c:/Users/me/.vim/bundle/snipmate-custom/snippets"
endif

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...