junegunn / vim-plug

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

Installation fails(?) on neovim 0.9.5 on Macos #1263

Closed grmpfhmbl closed 5 months ago

grmpfhmbl commented 5 months ago

I installed neovim 0.9.5 via homebrew (brew install neovim) and followed the installation instructions . On nvim start I get the following error:

Error detected while processing VimEnter Autocommands for "*":
E492: Not an editor command: PlugInstall --sync | source $MYVIMRC

I checked if the script was downloaded automatically to ~/.local/share/nvim/site/autoload/plug.vim. It was. Trying to run :Plug 'junegunn/vim-plug' directly from within neovim does result in essentially the same error: Not an editor command: Plug 'junegunn/vim-plug'

Looking at the output of :script it does not show plug.vim. When I move the file to ~/.local/share/nvim/site/plugin/plug.vim it at least shows up there, but I still get the same error.

  1: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime/ftplugin.vim
  2: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime/indent.vim
  3: ~/.config/nvim/init.vim
  4: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime/filetype.lua
  5: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime/syntax/syntax.vim
  6: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime/syntax/synload.vim
  7: ~/.local/share/nvim/site/plugin/plug.vim

Is there anything obvious that I'm doing wrong? Do you have any suggestions how to debug this further?


:version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Additional Info

Just to make sure, I also tried to install vim-plug on Ubuntu in Docker (docker run --rm -it ubuntu:latest). I build neovim 0.9.5 from source

git clone --branch v0.9.5 --depth 1 https://github.com/neovim/neovim
cd neovim
make CMAKE_BUILD_TYPE=RelWithDebInfo
make install

and followed the installation instructions but got the same errors / results.

junegunn commented 5 months ago

A script file in autoload directory is not loaded until one of its functions is called. In this case, plug#begin. Does your configuration file has a proper plug section? i.e. plug#begin() followed by Plug statements and the final plug#end().

grmpfhmbl commented 5 months ago

Ohh... I misunderstood / did not know that. Thank you. Adding a

call plug#begin()
  Plug 'junegunn/vim-plug'
call plug#end()

after the download has fixed the problem. Thank you again. Closing this issue.

junegunn commented 5 months ago

Plug 'junegunn/vim-plug'

This line is not necessary, because vim-plug itself is not a plugin.