junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.89k stars 1.9k forks source link

E492: No editor command when starting vim in root #1222

Closed couscous1 closed 5 months ago

couscous1 commented 1 year ago

Explain the problem here ... Whenever I open vim with root privileges and type in ANY vim-plug command eg PlugInstall, PlugStatus, etc I get the error E492: No editor command

When I write the exact same command in non root vim i can use any command. I checked for spelling, it doesent work. Help would be appreciated :)

 " automaitc installation of vim-plug (siehe tips des github docs)
 78 let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
 79 if empty(glob(data_dir . '/autoload/plug.vim'))
 80   silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
 81   autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
 82 endif
 83  
 84 " vim -plug code
 85 "
 86 call plug#begin('~/plugged')
 87  
 88 " vimtex
 89 Plug 'lervag/vimtex'
 90  
 91  
 92 call plug#end()
:version                                                                                                                                                       
VIM - Vi IMproved 9.0 (2022 Jun 28 kompiliert am Nov 19 2022 14:37:14)
Inklusive der Patches: 1-910
Übersetzt von Arch Linux
Riesige Version ohne GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften:
+acl               +cmdline_hist      +ex_extra          +jumplist          +mouse_dec         +perl/dyn          -sodium            +textobjects       +wildmenu
+arabic            +cmdline_info      +extra_search      +keymap            +mouse_gpm         +persistent_undo   -sound             +textprop          +windows
+autocmd           +comments          -farsi             +lambda            -mouse_jsbterm     +popupwin          +spell             +timers            +writebackup
+autochdir         +conceal           +file_in_path      +langmap           +mouse_netterm     +postscript        +startuptime       +title             -X11
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +statusline        -toolbar           -xfontset
-balloon_eval      +cscope            +float             +linebreak         -mouse_sysmouse    +profile           -sun_workshop      +user_commands     -xim
+balloon_eval_term +cursorbind        +folding           +lispindent        +mouse_urxvt       -python            +syntax            +vartabs           -xpm
-browse            +cursorshape       -footer            +listcmds          +mouse_xterm       +python3/dyn       +tag_binary        +vertsplit         -xsmp
++builtin_terms    +dialog_con        +fork()            +localmap          +multi_byte        +quickfix          -tag_old_static    +vim9script        -xterm_clipboard
+byte_offset       +diff              +gettext           +lua/dyn           +multi_lang        +reltime           -tag_any_white     +viminfo           -xterm_save
+channel           +digraphs          -hangul_input      +menu              -mzscheme          +rightleft         +tcl/dyn           +virtualedit
+cindent           -dnd               +iconv             +mksession         +netbeans_intg     +ruby/dyn          +termguicolors     +visual
-clientserver      -ebcdic            +insert_expand     +modify_fname      +num64             +scrollbind        +terminal          +visualextra
-clipboard         +emacs_tags        +ipv6              +mouse             +packages          +signs             +terminfo          +vreplace
+cmdline_compl     +eval              +job               -mouseshape        +path_extra        +smartindent       +termresponse      +wildignore
          System-vimrc-Datei: "/etc/vimrc"
        Benutzer-vimrc-Datei: "$HOME/.vimrc"
 zweite Benutzer-vimrc-Datei: "~/.vim/vimrc"
         Benutzer-exrc-Datei: "$HOME/.exrc"
      defaults Datei: "$VIMRUNTIME/defaults.vim"
     Voreinstellung für $VIM: "/usr/share/vim"
Übersetzt: gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ff
ile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linken: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl
/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -L/usr/local/lib -o vim -lm -ltinfo -lelf -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.36/core_perl/CORE -Wl,-O
1,--sort-common,--as-needed,-z,relro,-z,now -flto -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.36/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -l
tclstub8.6 -ldl -lz -lpthread -lm
junegunn commented 5 months ago

I think it's because you are now "root" and ~/.vimrc no longer points to that of the normal user. If that's the case, you need to create a .vimrc for the root user as well.