vim-plug
vim-plug copied to clipboard
unable to run vim-plug on WSL2
Cannot use PlugInstall or any other command in Vim or Neovim for WSL2. (windows 10)
Followed installing instructions but I always get a message:
E492: Not an editor command: PlugInstall
vim version and nvim version below
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +cindent +cursorshape +file_in_path +jumplist +mksession +mouse_xterm +printer +sound +terminal +virtualedit -xim
+arabic -clientserver +dialog_con +find_in_path +keymap +modify_fname +multi_byte +profile +spell +terminfo +visual -xpm
+autocmd -clipboard +diff +float +lambda +mouse +multi_lang -python +startuptime +termresponse +visualextra -xsmp
+autochdir +cmdline_compl +digraphs +folding +langmap -mouseshape -mzscheme +python3 +statusline +textobjects +viminfo -xterm_clipboard
-autoservername +cmdline_hist -dnd -footer +libcall +mouse_dec +netbeans_intg +quickfix -sun_workshop +textprop +vreplace -xterm_save
-balloon_eval +cmdline_info -ebcdic +fork() +linebreak +mouse_gpm +num64 +reltime +syntax +timers +wildignore
+balloon_eval_term +comments +emacs_tags +gettext +lispindent -mouse_jsbterm +packages +rightleft +tag_binary +title +wildmenu
-browse +conceal +eval -hangul_input +listcmds +mouse_netterm +path_extra -ruby -tag_old_static -toolbar +windows
++builtin_terms +cryptv +ex_extra +iconv +localmap +mouse_sgr -perl +scrollbind -tag_any_white +user_commands +writebackup
+byte_offset +cscope +extra_search +insert_expand -lua -mouse_sysmouse +persistent_undo +signs -tcl +vartabs -X11
+channel +cursorbind -farsi +job +menu +mouse_urxvt +postscript +smartindent +termguicolors +vertsplit -xfontset
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-iU6mZD/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -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 -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm
:version
NVIM v0.5.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6-d569569c9=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wa
ll -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_
GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6-d569569c9/build/config -I/build/neovim-OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6
-d569569c9/src -I/build/neovim-OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6-d569569c9/.deps/usr/include -I/usr/include -I/build/neovim-OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6-d569569c9/build/src/nvim/auto -I/build/neovim-
OqQfCc/neovim-0.5.0+ubuntu2+git202104182337-66f9dd3c6-d569569c9/build/include
Compiled by buildd@lgw01-amd64-022
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
- Type:
- [x ] Bug
- [ ] Enhancement
- [ ] Feature Request
- [ ] Question
- OS:
- [ ] All/Other
- [ ] Linux
- [ ] OS X
- [x ] Windows
- Vim:
- [x ] Terminal Vim
- [ ] GVim
- [x ] Neovim
Followed installing instructions
Which command did you run?
Vim and NeoVim commands as documentation states:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
and
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
SOLVED
Fix with a pretty convoluted workaround reading the:version
info output
Seems that VIM root folder in WSL is/
instead of $HOME
so placed the VIM config file in there inside a folder. Chowned to my user and then voilá. PlugInstall worked.
.vim/vimrc
Then NeoVim, reading :version
info the init file seems to be at
"$VIM/sysinit.vim"
Odd enough, that folder in WSL is the $HOME
folder as in any other linux distribution
/home/user
So I created a file named sysinit.vim
with all my configs and voilá. Working again....
we run curl -fLo ~/.vim/autoload/plug.vim --create-dirs \https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim and get the error:curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html So how to solve it ?
Thank you this worked for me too.
Had to create sysinit.vim
in user\(username)\
folder. It worked
Neovim Windows 10
Edit: Although once I tried re-installing Neovim and vim-plug altogether and it worked fine without extra work.
I got same issue with vim on Ubuntu (WSL) and solved as below.
1. command:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
2. create the ~/.vimrc file if not exist
As i run vim --version
we have the following output, then we know
system is reading .vimrc file in home folder
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"
then run following to create file if not yet have. cd ~; touch .vimrc
3. in the .vimrc
call plug#begin()
" Declare the list of plugins.
Plug 'tpope/vim-unimpaired'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
Key point is because we put the file in autoload folder, it only load the plugin if some function is called in the file. hence we call plug#begin() in .vimrc (mean if .vimrc empty, the vim-plug may not be loaded)
Below is from https://learnvimscriptthehardway.stevelosh.com/chapters/53.html
Autoload lets you delay loading code until it's actually needed. You'll take a slight performance hit overall, but if your users don't always use every single bit of code in your plugin autoloading can be a huge speedup.
Here's how it works. Look at the following command: :call somefile#Hello() ... vim will load autoload/somefile.vim....
4. restart vim
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
I recommend that you keep it simple and call plug#begin
without an argument unless you want to install plugins in a non-default directory. i.e. call plug#begin()
thank you @junegunn , it would be more simple to call call plug#begin()
only.