I am trying to have to custom commands in vim as follows: The first command just runs a bash script. this works fine on its own.
:command Build :!./build-linux.sh
Now I want to use this command in another such as this:
:command BuildAndDebug :Build | :call vimspector#Launch()
This command is supposed to run the bash script and then launch a debugger. When I try to do this, I get this error back:
E488: Trailing characters: :Build | :call vimspector#Launch()
I can't seem to find the trailing characters here. I suspect the :Build
is the cause of this because it does not know where the command ends. However I can't seem to get it to work at all.
You need to add the -bar
attribute to your command definition if you want to be able to "chain" other commands after it with |
:
:command -bar Build :!./build-linux.sh
This is described in chapter 40 of the user manual: :help usr_40
, and documented under :help :command-bar
.