vim-plug icon indicating copy to clipboard operation
vim-plug copied to clipboard

Make automatic installation script in wiki tips compatible with Neovim

Open clebs opened this issue 5 months ago • 8 comments

When using the snippet to auto install everything on Neovim it does not recognise PlugInstall as a command without restarting. To solve this I added one line to the suggested tip to source Plug right after downloading it.

It now looks as follows (in lua):

local data_dir = fn.stdpath('data')
if vim.fn.empty(vim.fn.glob(data_dir .. '/site/autoload/plug.vim')) == 1 then
	vim.cmd('silent !curl -fLo ' ..
		data_dir ..
		'/site/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim')
	vim.cmd('source ' .. data_dir .. '/site/autoload/plug.vim')
	vim.cmd('autocmd VimEnter * PlugInstall --sync | source $MYVIMRC')
end

Would it be possible to add this solution for those who get the error that PlugInstall is not a command on first setup with this tip?

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377
  • Type:
    • [ ] Bug
    • [x] Enhancement
    • [ ] Feature Request
    • [ ] Question
  • OS:
    • [x] All/Other
    • [ ] Linux
    • [ ] macOS
    • [ ] Windows
  • Vim:
    • [ ] Terminal Vim
    • [ ] GVim
    • [x] Neovim

clebs avatar Mar 05 '24 18:03 clebs