Unable to get Pathogen to work in Vim

I know there are a few posts on this, but I tried to no avail for this simple part of Vim to work. I would like to get the pathogen plugin to work with Vim. Like a few points, I am working on a Windows system. I downloaded the pathogen via github and created .vim directories and autoload and bundle subdirectories. My default .vimrc is created using mkvimrc with:

 call pathogen#infect() syntax on filetype plugin indent on 

added to the bottom. Turning to other posts, I saw:

 :set cp? = nocompatible 

One area that I assume is part of the problem after starting :scriptnames I do not get the .vim directory. I only get the Vim\.vimrc and vim73 . How can I answer that? I apologize for this for a long time, if it is obvious to others here.

+6
source share
3 answers

On Windows, the default local user configuration is $HOME/vimfiles . If your files are in $HOME/.vim , you need to either move them to vimfiles or add .vim to your execution path in your .vimrc:

 set runtimepath+=~/.vim 

In addition, if Pathogen is in the bundle subdirectory, you will need to explicitly run it, since by default Vim will only look in ~/.vim/ . Put this in your .vimrc before calling pathogen#infect :

 runtime bundle/pathogen/autoload/pathogen.vim 
+9
source

The solution for me was to reboot pathogen.vim , because it somehow could not load without redirecting. The URL specified in tpope github has the following step:

 mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim 

You will find out that the redirect failed to load because the contents of pathogen.vim will be the 302 redirect page. Just download from the URL contained in the redirect, for example:

 wget -N -O ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim 
+1
source

Open Vim with the plugins disabled and type :set rtp - note 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 a kind of Vim convention. after directories are used to force the default settings of Vim or plugins to be overridden, which is sometimes important. This is why they are the latest in rtp .

Pathogen actually analyzes the structure of your current rtp variable and uses it to correctly enter plugin paths in rtp . 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 introduced the paths. He found that several plugins have an after directory and place them right in front of ~/.vim/after - so the last word is always mine.

To achieve this pathogen, you need a pair of either ~/.vim , and ~/.vim/after , or ~/vimfiles and ~/vimfiles/after , or even ~/stuff and ~/stuff/after (not sure about the latter case) in as an anchor for injection plugins' paths in the correct order.

If any directory from this pair is missing, then you will have some unpleasant experience with the pathogen (as I once was until I found out all the above things and looked at the source code of the pathogen) - because the paths cannot proper injection.

Now you can see that the answer provided by Prince Goulash is completely wrong :

  • the first error was that he added ~/.vim to rtp , whereas he had to add it;
  • The second mistake is that he did not add ~/.vim/after .

The correct solution is as follows. If you need to work on different platforms, including Windows, you should add this to your .vimrc (I also keep this in my own - you can conclude from my rtp example):

 if has('win32') || has('win64') set runtimepath^=~/.vim set runtimepath+=~/.vim/after endif 

This snippet will ensure consistency between platforms. Now you can use the Unix-like .vim directory even on Windows and forget about shit vimfiles , which is an IMO ugly and terrible.

After that you call:

 call pathogen#infect('plugins') " or wherever your plugins reside call pathogen#helptags() " optional, but really cool 

NOTE. 'plugins' refers to the ~/.vim/plugins directory, therefore it refers to ~/.vim .

0
source

All Articles