1

I'm newbie in git, so question may be really stupid, sorry for that. I mean, I even found here on stackoverflow questions pretty close to mine, but still don't understand how to solve problem correctly.

I have github repo with my dotfiles, including for vim. I'm using pathogen with vim, so natural way to get plugins seams to be

git submodule add https://github.com/msanders/snipmate.vim.git vim/bundle/snipmate
...
git submodule init
git submodule update
git submodule foreach git submodule init
git submodule foreach git submodule update

wich I found somewhere. Last four commands I simply added to my setup script to run every time I clone this repo.

The first problem is git status always shows me

# modified:   vim/bundle/snipmate (untracked content)
# ...

in the # Changed but not updated: section and git add vim/bundle/snipmate doesn't help. It is pretty annoying.

The second problem is I obviously don't wand to keep snipmate snippets as default, I want to change them, and because of pathogen snippets are stored in snipmate folder, which is submodule, not my own repo. Of course, I could simply clone them there, or even create a fork of some of them, but is doesn't seem like a good solution:

  • It messes up my own code with other's code can be found on github;
  • I'm not really going to modify snipmate, I'm going to configure it;
  • All that stuff makes complicated or even impossible to update thirty-part plugins.

Maybe someone could help with finding a "correct" answer?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214

2 Answers2

0

You could start by reading snipmate's doc which states that the default recommended location for your own snippets is (supposing your stuff is under ~/.vim) ~/.vim/snippets/<filetype>.snippets. Outside of the plugin's directory, outside of the submodule.

Yes Git submodules are cool but they are probably not the perfect solution for managing your Vim config.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Yeah, and when using pathogen it will be .vim/bundle/snipmate/snippets/. Of course, I still can create my own .vim/snippets/, but the default set will be loaded anyway. – user1094249 Apr 07 '12 at 22:55
  • The idea is to put your own snippets in their own location so that you can update snipmate without overwriting your snippets. – romainl Apr 08 '12 at 08:05
  • I don't know what is your problem. [Snipmate](https://github.com/garbas/vim-snipmate) doesn't ship with default snippets: you have to install them separately. If you don't like them and want to use your own snippets, just don't install the package and put your snippets in `~/.vim/snippets/`. I can't think of a simpler setup. If you are using the [old snipmate](https://github.com/msanders/snipmate.vim), like I do, there is absolutely no point of importing it as a submodule as the project has been totally dead for 2 years. The setting for the snippets dir is at L189 of `:h snipmate`. – romainl Apr 08 '12 at 08:21
  • Yes, I was using tho old one. Thank you for the hint. Anyway, the main problem is I many times heard it's a good point to store vim plugins as submodules with pathogen, but it looks to me it isn't. So the question is: am I doing something wrong? Or that's just really not very convenient? – user1094249 Apr 08 '12 at 15:19
  • Well, *I don't think that* Git submodules are a good fit for that purpose precisely because you'd end more often than not in a situation where it's more practical to just download a .zip and copy the files. The new snipmate makes sense as a submodule because all the snippets are externalized: you can `pull` a new version without overwriting your own snippets. But what if you also added the suggested snippets package, made changes to it and decide to `pull` the latest version? – romainl Apr 08 '12 at 21:24
0

I use snipmate and pathogen with vim. Pathogen makes using submodules possible (and much easier!)

My snipmate plugin is installed here:

.vim/bundle/snipmate

My snippets are installed here:

.vim/bundle/snipmate-snippets

An example snippet is here:

.vim/bundle/snipmate-snippets/snippets/c.snippets

I also have a work-specific repo with snippets. They're here:

.vim/bundle/work/snippets/cpp.snippets

So long as there's a snippets folder in your runtimepath (:help rtp), you're good. That's the magic of pathogen.

To setup my submodules I did:

git submodule add git://github.com/garbas/vim-snipmate.git bundle/snipmate
git submodule add git://github.com/honza/snipmate-snippets.git bundle/snipmate-snippets

When I want to update my vim repo I do this:

git pull origin master
git submodule update --init

If I actually change the remote for a submodule (like if I forked snipmate on github and want to point my local repo at the new fork), I change .gitmodules and do:

git submodule sync

By using submodules, it will make it easier to update git submodule git pull origin and easier to modify and push updates back to the maintainer.

idbrii
  • 10,975
  • 5
  • 66
  • 107