Title: Unable to exit Neovim headless mode after nvchad.mason.install_all() finishes
Description:
I am trying to automate installing all Mason packages defined in M.mason.ensure_installed as well as LSPs defined in .config/nvim/lua/configs/lspconfig.lua and formatters in .config/nvim/lua/configs/conform.lua.
When I run inside Neovim:
everything works fine.
However, I want to run this in headless mode for automation (as part of my setup script) and ran into two problems:
- Running the direct command:
nvim --headless -c "MasonInstallAll" -c "quitall"
fails with:
E492: Not an editor command: MasonInstallAll%
- Running the Lua method works:
nvim --headless +"lua require('nvchad.mason').install_all()" +"autocmd User MasonUpdateAllComplete qa"
This successfully installs all packages, but Neovim stays stuck in headless mode after installation finishes. I expected it to quit automatically.
Full script I am using:
#!/bin/bash
set -e
# Step 1: Bootstrap NvChad
nvim --headless -c 'qa'
# Step 2: Sync Lazy.nvim plugins
nvim --headless -c 'Lazy sync' -c 'qa'
# Step 3: Install Mason packages
nvim --headless +"lua require('nvchad.mason').install_all()" +"autocmd User MasonUpdateAllComplete qa"
echo -e "\nNvChad, plugins, and Mason packages installed successfully!"
Expected behavior:
Neovim should quit automatically after Mason finishes installing all packages in headless mode.
Actual behavior:
It installs everything but does not exit headless mode, leaving the process hanging.
Environment:
If you want, I can also rewrite it so it includes the exact install list from lspconfig.lua and conform.lua for clarity before posting. This might help maintainers reproduce your case faster. Do you want me to do that?
Title: Unable to exit Neovim headless mode after
nvchad.mason.install_all()finishesDescription:
I am trying to automate installing all Mason packages defined in
M.mason.ensure_installedas well as LSPs defined in.config/nvim/lua/configs/lspconfig.luaand formatters in.config/nvim/lua/configs/conform.lua.When I run inside Neovim:
everything works fine.
However, I want to run this in headless mode for automation (as part of my setup script) and ran into two problems:
fails with:
This successfully installs all packages, but Neovim stays stuck in headless mode after installation finishes. I expected it to quit automatically.
Full script I am using:
Expected behavior:
Neovim should quit automatically after Mason finishes installing all packages in headless mode.
Actual behavior:
It installs everything but does not exit headless mode, leaving the process hanging.
Environment:
If you want, I can also rewrite it so it includes the exact install list from
lspconfig.luaandconform.luafor clarity before posting. This might help maintainers reproduce your case faster. Do you want me to do that?