2

So, I decided to manage my vimfiles (not dotfiles yet :P). I copied .vim and .vimrc inside a dotfiles folder (and removed the dot from the filenames). I initialized git dir and pushed it to Github. When I pull the files from Github, i have issues running Vim. It has trouble running Vundle commands (vundle#start and vundle#end, and all Plugin statements). I started believing that it was a second loaded .vimrc, so running :version shows this:

   system vimrc file: "$VIM/vimrc"                                                                                                                                                         
     user vimrc file: "$HOME/.vimrc"                                                                                                                                                       
 2nd user vimrc file: "~/.vim/vimrc"                                                                                                                                                       
      user exrc file: "$HOME/.exrc"                                                                                                                                                        
  fall-back for $VIM: "/usr/share/vim"

The 2nd user vimrc file doesn't exist physically, so i'm utterly confused. Any ideas?

enter image description here

1 Answer 1

3

I assume you installed Vundle the usual way (git clone https://github.com/gmarik/Vundle.vim ~/.vim/bundle/...). When you initialized a Git repository on .vim, Vundle's directory will be seen as a Git link instead of a Git submodule. This complicates things, since there's no simple way to add the plugins as part of the overall repo. What you could do is:

  1. remove the plugin directories from git, but not their actual contents:

    git rm --cached bundle/Vundle.vim
    
  2. Re-add it as a submodule:

    git submodule add https://github.com/gmarik/Vundle.vim.git bundle/Vundle.vim
    

Then commit your changes. Depending on where Vundle is keeping your other plugins, you might want to add them as submodules too.

If you look at your Github repository, you should find the Vundle directory looking like these:

enter image description here

These are plugins in my ~/.vim/bundle, added as submodules by my git vim repo. Note the revision numbers added to each.

You'll have to initialize and update the submodules for the actual Vundle code to appear:

git submodule init
# or
git submodule update --init

This can also be done at the time of cloning:

git clone https://github.com/my/vim/repo ~/.vim --recursive
5
  • and then? how do i proceed? how do i fetch the data from the submodules to my local folder?
    – gemantzu
    Commented Jun 29, 2015 at 11:46
  • @h1k3n O.o That's what those commands are for. git submodule update --init should clone the Vundle repository.
    – muru
    Commented Jun 29, 2015 at 11:48
  • i feel lost. let me revisit this in the afternoon when i cool my head as it has been a tough day here in Greece. Thnx though, it seems that this topic stepped in a black area for me in git (submodules) that i need to explore.
    – gemantzu
    Commented Jun 29, 2015 at 11:51
  • I used those commands but they show no output and at the end i have only the folders of each submodule (maybe they aren't submodules in my case after all?). I think i have made a mistake in the initialization of the process.
    – gemantzu
    Commented Jun 30, 2015 at 6:26
  • @h1k3n Guess I was wrong - when you added the bundle directory, the plugin directories didn't become proper submodules, but only git links. See stackoverflow.com/a/4162672/2072269. Essentially, in your original repo, do git rm --cached for the plugin directories, then re-add them as submodules.
    – muru
    Commented Jun 30, 2015 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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