What I have referenced in my .zshrc file:

nvim --headless -c 'LspInstall tsserver | qall'

This doesn't work. The qall is regarded as an argument of LspInstall while I didn't mean to. The LspInstall will take some time to download the language servers, thus it seems like that I need some pseudo-command like:

await LspInstall tsserver then qall

Any idea?

  • 1
    You can use multiple -c flags. Does nvim --headless -c 'LspInstall tsserver' -c 'qall' work?
    – B Layer
    Oct 5, 2021 at 9:37
  • @BLayer: You're awesome :) It works! Sorry for my easy question. Oct 5, 2021 at 9:51
  • :) No worries. .
    – B Layer
    Oct 5, 2021 at 9:52

2 Answers 2


I guess the LspInstall user command is configured to take multiple parameters. No matter, you can use multiple -c flags, each with their own command(s).


You can use up to 10 "+" or "-c" arguments in a Vim command. They are executed in the order given. A "-S" argument counts as a "-c" argument as well.

(Source: :h -c)

So try...

nvim --headless -c 'LspInstall tsserver' -c 'qall'
  • 1
    I'm happy-happy now~ Oct 5, 2021 at 9:54
  • It is more likely the command wasn’t declared with -bar, in which case the bar wont work. Wrapping in execute will, or multiple commands, as you pointed out. (-nargs= whatever has nothing to do with bar-handling, in other words.)
    – D. Ben Knoble
    Oct 5, 2021 at 12:10

An alternative solution that works if you're running the commands inside a Vim instance (you're not, but the existing answer is already the best solution for your exact circumstances) is to use :execute to more specifically delimit the arguments to the LspInstall command.

Instead of:

:LspInstall tsserver | qall

You can use:

:execute "LspInstall tsserver" | qall
  • As I said under the other answer, I suspect LspInstall is missing -bar
    – D. Ben Knoble
    Oct 5, 2021 at 16:02

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.