每次尝试在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
安装vim后我没有更改任何配置,所以它是完全纯净的。
我的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
我的操作系统详细信息:
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
答案 0 :(得分:0)
问题似乎是由于/usr/share/vim/vimrc
中的未注释行
要修复此问题,只需在文件的第57行注释。
因此从Source a global configuration file if available
更改行的内容
到" Source a global configuration file if available
希望如果没有任何其他问题,它应该可以正常工作而不会产生任何其他抱怨。
答案 1 :(得分:0)
在Ubuntu 20.10上的修复
使用工具重新安装:
apt purge vim -y && rm -rf /etc/vim && apt install vim* -y
问题:将Ubuntu20.04升级到20.10和18.04升级到20.04之后,库的配置和som损坏了))
修复:使用(*)安装所有依赖项以及带有vim编辑器的更多可用工具
如果您在重新安装后不想要它:
apt purge vim* -y && apt install vim -y
这个想法是为“ vim”安装所有必要的库,如果不想的话 所有收费将删除工具,但您将保存必要的库 通过使用您的apt软件包管理器,秘密就在(*);)
BR