I have a script that updates my system. It updates system packages, remove orphaned packages, update R packages, update software pip-installed in python virtual environments.

I would like to use this Bash script to update my Neovim plugins as well.

I use lazy.nvim as package manager.

Is is possible to update the plugins from the command line?

2 Answers 2


From the docs at https://github.com/folke/lazy.nvim:

$ nvim --headless "+Lazy! sync" +qa

  • Ops ... I should have read that! Jan 30 at 5:33
  • @robertspierre You aren't by chance trying to get this to work in a Dockerfile are you? I can't seem to get it to work from a dockerfile but it works fine if I run it from a running container. Not sure what the problem is.
    – StevieD
    Jan 30 at 5:49
  • no just normal command line Jan 30 at 6:21

I would do:

nvim -c "Lazy update" -c "sleep 120" -c "qa"

Or using cmd Windows argument passing:

nvim -c "Lazy update"  -c "sleep 120"  -c "call feedkeys("":qa\<cr>"")"

Or using bash Linux arguments passing:

nvim -c "Lazy update"  -c "sleep 120"  -c "call feedkeys(\":qa\\<cr>\")"

For most of the plugins the only thing that Lazy is doing is doing a git pull on each plugin folders (~/.config/nvim-data/lazy/*)


pushd ~/.config/nvim-data/lazy
for file in *; do
    if [ -f "$file" ]; then
    echo "Update: " $file
    cd $file
    git pull
    cd ..
  • 1
    Uhm I tried the first one and it didn't seem to work. There were several updates that were not retrieved. Jan 26 at 6:22
  • I have Linux BTW Jan 26 at 6:22
  • 1
    If you don't add the code that close Neovim (`-c "q") do you get all the updates? Jan 26 at 10:33
  • why the feedkeys() function instead of just using -c"q"? Jan 26 at 10:33
  • 1
    yeah, perhaps it's running in async mode and so the :q is processed before the update is complete Jan 26 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.