Vim 缺少某些内容 - vimrc 错误

Vim 缺少某些内容 - vimrc 错误

我是 Vim 新手。当我从终端运行它时,我收到此错误:

Error detected while processing /home/Rob/.vimrc:
line   28:
E492: Not an editor command: Plugin 'vim-pandoc/vim-rmarkdown'

它似乎仍在运行,但我并没有真正用它做太多事情,所以我确定我还没有遇到错误。我应该修复什么以及如何解决它?

Rob@Rob:~ $ cat ~/.vimrc
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'

" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:

execute pathogen#infect()
syntax on
filetype plugin indent on

Plugin 'vim-pandoc/vim-rmarkdown'

这是运行的结果apt search --names-only vim | grep install

$ sudo apt search --names-only vim | grep installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

vim-common/oldstable,oldstable,oldstable,oldstable,now 2:8.0.0197-4+deb9u3 all [installed,automatic]
vim-gtk/oldstable,oldstable,now 2:8.0.0197-4+deb9u3 amd64 [installed]
vim-gui-common/oldstable,oldstable,oldstable,oldstable,now 2:8.0.0197-4+deb9u3 all [installed,automatic]
vim-runtime/oldstable,oldstable,oldstable,oldstable,now 2:8.0.0197-4+deb9u3 all [installed,automatic]
vim-tiny/oldstable,oldstable,now 2:8.0.0197-4+deb9u3 amd64 [installed]

答案1

看起来有问题的行是文件中的最后一行(第 28 行):

Plugin 'vim-pandoc/vim-rmarkdown'

我假设您使用其中一个vim插件管理器安装了插件,并且插件文件安装在了它们应该在的位置。如果没有,您是如何安装的?更重要的是,错误消息显示python required。您安装了 Python 吗?尝试:

apt search --names-only python

这将显示包名称中包含单词“python”的包(--names-only),并过滤掉仅显示“已安装”的包(| grep installed)。例如,如果我在计算机上执行此操作,则输出包括:

python2/eoan,now 2.7.17-1 amd64 [installed,automatic]
python3/eoan,now 3.7.5-1 amd64 [installed,automatic]

通常 Python 已预装在大多数 Ubuntu 安装中,因此最好验证一下。无需在此处复制输出,但请检查是否安装了 python 2 和/或 python 3,就像我的一样。

相关内容