首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vundle (Vim插件)配置问题

Vundle (Vim插件)配置问题
EN

Ask Ubuntu用户
提问于 2019-02-06 14:29:48
回答 1查看 988关注 0票数 0

我在我的/etc/vim/vimrc中编写了下面的配置来运行Vundle插件。

我为什么会犯这个错误?

我添加的Vim配置块:

代码语言:javascript
复制
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时,我得到了以下错误:

代码语言:javascript
复制
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'

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 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,它们是不同的文件。

票数 2
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1116114

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档