vimpathogen

runtimepath set, but pathogen#infect unknown function error


I'm trying to setup my vim so I can use my settings as the root user without messing with root's .vim and .vimrc.

My vim setup works perfectly when called from my own user. However, when called from the root user I get:

E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()

I have set the runtime path in my .vimrc and running with debug gives the following:

chdir(/home/pricery)
fchdir() to previous dir
sourcing "/home/pricery/.vimrc"
Searching for "autoload/pathogen.vim" in "/home/pricery/.vim,/usr/share/vim/vim74"
Searching for "/home/pricery/.vim/autoload/pathogen.vim"
chdir(/home/pricery/.vim/autoload)
fchdir() to previous dir
line 5: sourcing "/home/pricery/.vim/autoload/pathogen.vim"
finished sourcing /home/pricery/.vim/autoload/pathogen.vim
continuing in /home/pricery/.vimrc
Searching for "autoload/pathogen.vim" in "/home/pricery/.vim,/usr/share/vim/vim74"
Searching for "/home/pricery/.vim/autoload/pathogen.vim"
chdir(/home/pricery/.vim/autoload)
fchdir() to previous dir
line 5: sourcing "/home/pricery/.vim/autoload/pathogen.vim"
finished sourcing /home/pricery/.vim/autoload/pathogen.vim
continuing in /home/pricery/.vimrc
                                  Error detected while processing /home/pricery/.vimrc:
line    5:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
finished sourcing /home/pricery/.vimrc
Searching for "plugin/**/*.vim" in "/home/pricery/.vim,/usr/share/vim/vim74"
Searching for "/home/pricery/.vim/plugin/**/*.vim"
Searching for "/usr/share/vim/vim74/plugin/**/*.vim"
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
...

So as far as I can tell its finding my .vim folder and loading pathogen.vim fine, but then still throws the error of not knowing the pathogen#infect function and therefore doesn't load the rest of my plugins.

Anyone have any idea what I'm missing?


Solution

  • You need to set nocompatible in your .vimrc before invoking pathogen#infect