我在我的/etc/vim/vimrc中编写了下面的配置来运行Vundle插件。
我为什么会犯这个错误?
我添加的Vim配置块:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line在运行.vimrc时,我得到了以下错误:
root@someone-System-Product-Name:/etc/vim# vim vimrc
Error detected while processing /usr/share/vim/vimrc:
line 6:
E117: Unknown function: vundle#begin
line 11:
E492: Not an editor command: Plugin 'VundleVim/Vundle.vim'
line 14:
E117: Unknown function: vundle#end
Press ENTER or type command to continue如果运行:PluginInstall,就会得到错误'Not an editor command'。
发布于 2019-02-07 07:36:52
您正在将系统范围的配置与用户配置混合在一起。
游乐手册建议向“您的.vimrc”(即~/.vimrc )添加一个脚本,特别是向~/.vim/bundle/Vundle.vim添加一个链接。这两个文件都驻留在用户的主目录(~)中,不影响其他用户。
但是,如果您将脚本(包括指向用户主目录的链接!)对于系统范围的Vim配置/etc/vim/vimrc,您必须
Vundle.vim放置到系统范围内有效的位置(例如,/opt、/etc/vim),并在/etc/vim/vimrc中提供路径。~/.vim/bundle/Vundle.vim存在于任何用户,包括根用户。根的主目录(~)是/root。因此,如果您的计算机上不存在/root/.vim/bundle/Vundle.vim文件,那么当将/etc/vim/vimrc作为根用户处理时,Vim将无法加载它。
在运行
.vimrc:# vimrc时,我得到了这些错误
这可能与打开vimrc文件无关,问题影响启动Vim本身,因为Vim在此期间读取其配置文件。即使您在没有任何文件的情况下发出普通的vim命令,也会发生这种情况。
顺便说一句,请注意文件名的每个字符。vimrc不等于.vimrc,它们是不同的文件。
https://askubuntu.com/questions/1116114
复制相似问题