-
Hello, I have started a migration to nvim+lua and decided to move from Plug to Packer as well. I have Packer cloned, the issue seems in the loading order. I would like to clone my configuration and bootstrap it with this command: $ nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' The problem I have is that the color scheme is not being installed, which leads to this error: $ nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
Error detected while processing /usr/local/home/cgi/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /usr/local/home/cgi/.config/nvim/lua/settings.lua:48: Vim(colorscheme):E185: Cannot find color scheme 'gruvbox'
stack traceback:
[C]: in function 'cmd'
/usr/local/home/cgi/.config/nvim/lua/settings.lua:48: in main chunk
[C]: in function 'require'
/usr/local/home/cgi/.config/nvim/init.lua:18: in main chunkError detected while processing command line:
E492: Not an editor command: PackerSync Here is my ~/.config/nvim/init.lua (simplified): require('settings')
require('autocommands')
require('plugins') The I tried changing the order of There were several question, which looks similar, but I don't understand how should I proceed:
Can someone please helm me to fix this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I believe that this is a problem only with bootstrapping - the colorscheme loading error seems to prevent the rest of As @mjlbach mentioned on Matrix, you can use a trick wherein you set an environment variable to signal that you're in an installation run and skip the parts of the config that rely on yet-uninstalled dependencies. If you only ever use headless Neovim for installs/bootstrapping, a slightly easier version of this trick checks the number of attached UIs ( Another possible workaround is to wrap the |
Beta Was this translation helpful? Give feedback.
-
I've come with simple WTR solution: $ cat <<EOF > simple.lua
print("Test configuration has sucessfully been loaded")
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'morhetz/gruvbox'
end)
cmd [[colorscheme gruvbox]]
EOF
# make sure the gruvbox is not installed, remove generated cache
$ rm -rf ~/.local/share/nvim/site/pack/packer/start/gruvbox
$ rm -f ~/.config/nvim/plugin/packer_compiled.lua
# try to start neovim
$ nvim -u simple.lua
Test configuration has sucessfully been loaded
Error detected while processing /usr/local/home/cgi/simple.lua:
E5113: Error while calling lua chunk: simple.lua:11: attempt to call global 'cmd' (a nil value)
stack traceback:
simple.lua:11: in main chunk
Press ENTER or type command to continue I tried using Actually, after wrinthing this I came with an idea: $ nvim -u .config/nvim/lua/plugins.lua --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' Aaand it worked like a charm 🥳 If all plugin requirements are collected in a single file, we can load it for bootstrap, ignoring all other settings. |
Beta Was this translation helpful? Give feedback.
I've come with simple WTR solution: