1

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.