windowsgitvimnerdtreepathogen

Vim plugins not working with pathogen


I've got a computer with windows 7 in which I've recently installed Git (with Vim inside the Git directory). I tried installed pathogen and apparently it is installed correctly since there are no error messages with pathogen in autoload. My _vimrc is located in Users/Username which is $HOME and it the following is relevant to pathogen.

execute pathogen#infect() //_vimrc starts with this line
call pathogen#helptags()
syntax on
filetype plugin indent on

the path to autoload and bundle is: C:/progra~1/git/usr/share/vim/vim74/autoload(and vim74/bundle)

When I clone a plugin (ex. NerdTree) to bundle, the following message appears when I open Vim.

Error detected while processing /usr/share/vim/vim74/bundle/nerdtree/plugin/NERD_tree.vim:
line   16:
E15: Invalid expression: exists("loaded_nerd_tree")^M
line  211:
E171: Missing :endif

I also start a session in vim and use

:help NERD_tree.txt 

but it returns "Sorry, no help for NERD_tree.txt"

Does anybody know what is causing the problem and has the solution?


Solution

  • First

    All your configuration is supposed to happen in $HOME/.vim/ (plugins, colorschemes, etc.) and $HOME/.vimrc (options, mappings, etc.). Note also that, since Vim 7.4, it is possible to have your vimrc directly inside $HOME/.vim/, which makes managing your configuration even easier.

    Whatever you did in /usr/share/vim/ should be reverted ASAP.

    Second

    But your issue is caused by line-endings: the cloning process changed the ones used by the author — lf — to the standard ones on Windows — crlf. Because Vim only accepts lf it was unable to source your plugin.

    The cause is most likely the value of core.autocrlf in your Git settings.

    The command below should prevent Git from converting lf to crlf upon checkout/clone/pull/etc.:

     git config --global core.autocrlf false