我正在尝试设置我的vim,因此我可以将我的设置用作root用户,而不会弄乱root用户的.vim和.vimrc。
从我自己的用户调用时,我的vim设置工作正常。但是,当从root用户调用时,我得到:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
我在.vimrc中设置了运行时路径,并使用debug运行,提供了以下内容:
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很好,但是仍然会抛出不知道病原#refect功能的错误,因此不会加载其余的插件
任何人都知道我错过了什么?
答案 0 :(得分:1)
在调用nocompatible
之前,您需要在.vimrc
设置pathogen#infect