Question

I have pathogen set up in my vim installation and various plugins installed.

"Call pathogen to set up various plugins
"filetype off
call pathogen#infect()
call pathogen#incubate()
call pathogen#helptags()

When I write my .vimrc in vim, the following command is supposed to reload the file (and it does seem to work).

" Source the vimrc file after saving it
if has("autocmd")
  autocmd bufwritepost .vimrc source $MYVIMRC
endif

After writing .vimrc, however, pathogen does not reload.

Here is the output of :set rtp? after starting vim:

runtimepath=~/.vim,~/.vim/bundle/Jellybeans,~/.vim/bundle/TwitVim,~/.vim/bundl
e/badwolf,~/.vim/bundle/calendar,~/.vim/bundle/tagbar,~/.vim/bundle/vim-airline,
~/.vim/bundle/vim-colors-solarized,~/.vim/bundle/vim-colorschemes,~/.vim/bundle/
vizardry,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/s
hare/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after 

and after :w in .vimrc it returns to the default.

 runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/
vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

I tried adding the following modification to no avail...

if has("autocmd")
    autocmd bufwritepost .vimrc source $MYVIMRC
    autocmd bufwritepost .vimrc call pathogen#incubate()
endif

I've been looking around and can't seem to find a solution other than just restarting vim every time I modify my .vimrc, which is fairly disruptive. Any help would be appreciated.

edit: output of tree -d -L 2...

.
├── autoload
└── bundle
    ├── badwolf
    ├── calendar
    ├── color~
    ├── Jellybeans
    ├── tagbar
    ├── TwitVim
    ├── vim-airline
    ├── vim-colorschemes
    ├── vim-colors-solarized
    └── vizardry
Was it helpful?

Solution

The problem may be the following lines on your .vimrc:

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

On $VIMRUNTIME/debian.vim there is a line that reset the runtime path:

" Debian system-wide default configuration Vim

set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

The problem doesn't happens when the .vimrc is loaded on startup because these lines are executed before call pathogen#infect(). When you reload your .vimrc you are overwriting your &rtp, but pathogen doesn't set it again (possible because s:done_bundles is already set).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top