Open Vim with disabled plugins and type :set rtp
- notice that:
- if you are on Unix, then by default: the first goes
~/.vim
and the last goes ~/.vim/after
;
- if you are on Windows, then by default: the first goes
~/vimfiles
and the last goes ~/vimfiles/after
.
This is sort of Vim convention. after
directories are used to forcefully override Vim's defaults or plugins' settings, which is important sometimes. That's why they are the last in the rtp
.
Pathogen actually parses the structure of your current rtp
variable and uses it to inject paths of plugins into the rtp
properly. For example, look at my rtp
:
runtimepath=
~/.vim,
~\.vim\plugins\NERDCommenter,
~\.vim\plugins\NERDTree,
~\.vim\plugins\SameSyntaxMotion,
~\.vim\plugins\Tabular,
~\.vim\plugins\UltiSnips,
~\.vim\plugins\c.vim,
~\.vim\plugins\clang_complete,
~\.vim\plugins\CountJump,
~\.vim\plugins\delimitMate,
~\.vim\plugins\fswitch,
~\.vim\plugins\matchit,
~\.vim\plugins\matlab,
~\.vim\plugins\neocomplcache,
~\.vim\plugins\protodef,
~\.vim\plugins\python-syntax,
~\.vim\plugins\solarized,
~\.vim\plugins\syntastic,
~\.vim\plugins\vim-creole,
~\.vim\plugins\vim-latex,
~\.vim\plugins\vim-markdown,
~\.vim\plugins\vim-python-pep8-indent,
~/vimfiles,
D:\Applications\Vim/vimfiles,
D:\Applications\Vim,
D:\Applications\Vim/vimfiles/after,
~/vimfiles/after,
~\.vim\plugins\Tabular\after,
~\.vim\plugins\UltiSnips\after,
~\.vim\plugins\vim-markdown\after,
~/.vim/after
Notice how pathogen injected paths. It has detected that several plugins have after
directory and put them right before ~/.vim/after
- so that the last word is always mine.
To achieve this pathogen needs a pair of either ~/.vim
and ~/.vim/after
or ~/vimfiles
and ~/vimfiles/after
or even ~/stuff
and ~/stuff/after
(not sure about the last case though) as anchors to inject plugins' paths in the right order.
If any directory from this pair is missing, then you will have some nasty experience with pathogen (as I did sometime ago, until I found out all the aforementioned stuff and skimmed through pathogen source code) - because paths will not be able to be injected correctly.
Now you can see that the answer provided by Prince Goulash
is completely wrong:
- the first mistake is that he has appended
~/.vim
to rtp
whereas
he should have prepended it;
- the second mistake is that he didn't append
~/.vim/after
.
The correct solution looks as follows. If you have to work on different platforms including Windows you should rather add this into your .vimrc
(I keep this in mine as well - you can infer it from my rtp
example):
if has('win32') || has('win64')
set runtimepath^=~/.vim
set runtimepath+=~/.vim/after
endif
This snippet will ensure consistency across platforms. You can now use Unix-like directory .vim
even in Windows and forget about the vimfiles
crap - which is IMO ugly and awful.
After that you call:
call pathogen#infect('plugins') " or wherever your plugins reside
call pathogen#helptags() " optional, but really cool
NOTE: 'plugins'
denotes the ~/.vim/plugins
directory, so it is relative of ~/.vim
.