3

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?

0

1 Answer 1

2

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
3
  • Thank you! it worked. About the usr/share/vim, that was default. When I installed Git that's how Vim came. When I installed pathogen in the autoload in that folder it worked, but when I tried with a vim folder in $HOME it didn't take it into account.
    – Charles
    Sep 3, 2015 at 13:08
  • I also had the same problem with line endings. For me it was :set ff=mac on the offending nerdtree file that did the thing.
    – Koshmaar
    Nov 12, 2015 at 11:39
  • Actually it did help with vim that stopped shouting about ^M, but the plugin wasn't properly loaded. So I had to remove nerdtree and re-download with the changed autocrlf to false.
    – Koshmaar
    Nov 12, 2015 at 11:57

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.