当我在文件上使用 sudo vim 时,它失败并显示:
$ sudo vim test
Error detected while processing /home/dcampbe1/.vimrc:
line 12:
E117: Unknown function: vundle#begin
line 13:
E492: Not an editor command: Plugin 'VundleVim/vundle.vim'
line 14:
E492: Not an editor command: Plugin 'bundle/vim-colors-solarized'
line 15:
E492: Not an editor command: Plugin 'tpope/vim-fugitive'
line 16:
E492: Not an editor command: Plugin 'w0ng/vim-hybrid'
line 17:
E492: Not an editor command: Plugin 'airblade/vim-gitgutter'
line 18:
E492: Not an editor command: Plugin 'vim-airline/vim-airline'
line 19:
E492: Not an editor command: Plugin 'vim-airline/vim-airline-themes'
line 20:
E492: Not an editor command: Plugin 'jreybert/vimagit'
line 21:
E492: Not an editor command: Plugin 'valloric/youcompleteme'
line 22:
E492: Not an editor command: Plugin 'scrooloose/nerdtree'
line 23:
E117: Unknown function: vundle#end
line 26:
E185: Cannot find color scheme 'hybrid'
line 149:
E471: Argument required
Press ENTER or type command to continue
但是,当我在同一个文件上运行 vim 时,它会使用正确的 vundle 配置正确打开。我需要经常使用 sudo vim,因为许多文件由 root 而不是我的用户拥有。我对运行 sudo vim 时使用的正常根配置没问题,但是令我惊讶的是 sudo vim 尝试进入我的 vundle 配置并以某种方式失败。
有人知道发生了什么事吗?修复运行 sudo vim 仅转到普通 root vim 或转到 .vimrc 中我自己配置的 vim 的情况。