Sublime Forum

How do I use subl --command at a cmd prompt


At the cmd prompt, type C:> subl --command select_all to get better execution.

The command command is searched using sublime Keymap.

For example
For select_all,

{“keys”: [“ctrl + a”], “command”: “select_all”}

I would like to know how to use the example below.

{“keys”: [“ctrl + backspace”], “command”: “delete_word”, “args”: {“forward”: false}}

I don’t know how to use “args” like
You probably know how to use the args parameter with cmd propt.

1 Like


The value of the --command argument to subl is a single string that represents the command to execute and the arguments to pass to the command (if any are needed). The arguments you provide should be in a JSON dict just like they would appear in Sublime.

Since both the command and the arguments need to be in a single command line argument, you need to wrap the command and the arguments in quote characters so that the command prompt will see them as a single argument. However, quote characters are also needed in the JSON args to the command, so you need to quote them so that the command interpreter will leave them alone.

For the example you provided above, that would look like:

subl --command "delete_word {\"forward\": false}"
1 Like