运行时路径设置,但病原体#infect 未知函数错误

runtimepath set, but pathogen#infect unknown function error

我正在尝试设置我的 vim,这样我就可以使用我的设置作为 root 用户,而不会弄乱 root 的 .vim 和 .vimrc.

我的 vim 设置在我自己的用户调用时完美运行。但是,当从 root 用户调用时,我得到:

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

我已经在我的 .vimrc 中设置了运行时路径,运行 调试给出了以下内容:

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
...

据我所知,它找到了我的 .vim 文件夹并加载 pathogen.vim 正常,但仍然会抛出不知道病原体#infect 函数的错误,因此不会加载我的其余插件。

有人知道我错过了什么吗?

在调用 pathogen#infect

之前,您需要在 .vimrc 中设置 nocompatible