.vimrc 仅在 virtualenv 内部导致错误

.vimrc causes error only inside virtualenv

我本来打算使用 VIM 编辑器在 venv 中进行开发,我使用一台大学机器设置了我相信从服务器加载 python36 的命令。 (因为我要使用 scl)在这个特定的 venv 之外,我调用 vi 命令来编辑文件没有问题,但我在 venv.

(venv) [----]UUN: vi ~/.vimrc
Error detected while processing /afs/inf.ed.ac.uk/user/s18/sUUN/.vimrc:
line   11:
E492: Not an editor command: Plugin 'gmarik/Vundle.vim'
line   13:
E492: Not an editor command: Plugin 'https://github.com/nvie/vim-flake8'
line   14:
E492: Not an editor command: Plugin 'scrooloose/nerdtree'
line   15:
E492: Not an editor command: Plugin 'Royal-Colorschemes'
line   16:
E492: Not an editor command: Plugin 'powerline/powerline'
line   22:
E492: Not an editor command: Bundle 'godlygeek/tabular'

我不明白为什么。谁能指教一下。。下面是我的~/.vimrc不在venv上。

1 set nocompatible
2 filetype off
3 
4 " set the runtime path to include Vundle and initialize
5 set rtp+=~/.vim/bundle/Vundle.vim
6 call vundle#begin()
7 " alternatively, pass a path where Vundle should install plugins
8 "call vundle#begin('~/some/path/here')
9 
10 " let Vundle manage Vundle, required
11 Plugin 'gmarik/Vundle.vim'
12 "place plugin here
13 Plugin 'https://github.com/nvie/vim-flake8'
14 Plugin 'scrooloose/nerdtree'
15 Plugin 'Royal-Colorschemes'
16 Plugin 'powerline/powerline'
17 " All of your Plugins must be added before the following line
18 call vundle#end()            " required
19 
20 filetype plugin indent on
21 
22 Bundle 'godlygeek/tabular'
23 set fileencodings=utf-8
24 set encoding=utf-8
25 
26 syntax on
27 
28 set tabstop=8
29 set expandtab
30 set shiftwidth=4
31 set softtabstop=4
32 
33 set nu
34 set paste
35 
36 set autoindent
37 set cindent
38 
39 set laststatus=2
40 set modeline
41 set background=dark
42 
43 " Key Map "
44 nmap nerd :NERDTreeToggle<CR>

使用 VIM 成功了! 谢谢你。 (但为什么它不适用于 vi?)

它在 vi 中不起作用,因为你还没有set compatible。相反,您已经在 .vimrc 中明确设置了不兼容模式:set nocompatible。您可以尝试将兼容模式设置为打开,但我怀疑这些插件中的任何一个是否可以工作——但我还没有亲自测试过这一点。相反,我遵循经验法则:在使用为 vim 编写的插件时使用 vim。