简体   繁体   English

Vim “处理 /usr/share/vim/vimrc 时检测到错误”

[英]Vim "Error detected while processing /usr/share/vim/vimrc"

After installing vim in ubuntu 18.04 every time I try to use it I get the following Error message:在 ubuntu 18.04 中安装 vim 后,每次我尝试使用它时,都会收到以下错误消息:

$ vim
Error detected while processing /usr/share/vim/vimrc:
line   57:
E492: Not an editor command:  Source a global configuration file if available
Press ENTER or type command to continue

I didn't change any configuration after installing vim so it's totally pure.安装 vim 后我没有更改任何配置,所以它是完全纯净的。

The details of my vim instance:我的 vim 实例的详细信息:

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               -perl              +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               -ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-NQEcoP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm 

My OS details:我的操作系统详细信息:

Linux HOSTNAME 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

fix on Ubuntu 20.10修复 Ubuntu 20.10

Reinstalling with tools:使用工具重新安装:

apt purge vim -y && rm -rf /etc/vim && apt install vim* -y 

The issue: broken config and som of libraries after upgrade Ubuntu20.04 to 20.10 and 18.04 to 20.04;)问题:将 Ubuntu20.04 升级到 20.10 并将 18.04 升级到 20.04 后,配置和一些库损坏;)

fix: Use(*) to install all dependencies plus more usable tools with vim editor修复:使用(*)安装所有依赖项以及 vim 编辑器的更多可用工具

If you don't want it after reinstalling:如果您在重新安装后不想要它:

apt purge vim* -y && apt install vim -y

The idea is to install all necessary libraries for "vim" and if don't want all the tolls you will remove the tools but you will save the necessary libraries by using your apt package manager, the secret is in (*);)这个想法是为“vim”安装所有必要的库,如果不想要所有的通行费,你将删除这些工具,但你将使用你的 apt 包管理器保存必要的库,秘密在 (*);)

BR BR

It seems the problem is due to an uncommented line in /usr/share/vim/vimrc看来问题是由于/usr/share/vim/vimrc中未注释的行

to fix it simply comment line 57 of the file.要修复它,只需注释文件的第 57 行。

so change the content of the line from Source a global configuration file if available TO " Source a global configuration file if available因此,将行的内容从Source a global configuration file if available更改为" Source a global configuration file if available

hopefully if there isn't any other problem it should work without any other complain.希望如果没有任何其他问题,它应该可以在没有任何其他抱怨的情况下工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM