Reputation: 16891
I must be having a bad search day, but I can't find any information about how to customize Sublime Text 2 so that toggle comment
works correctly for windows batch files (i.e. adding either a REM
or ::
to the beginning of a line). Any help?
Upvotes: 1
Views: 1333
Reputation: 5572
You can create a plugin or a macro to do it. Perhaps a snippet already exists but i have not found it.
I will try to explain the "create macro" alternative.
Create a macro with this code (save it in Packages/User, with name what-you-want.sublime-macro):
[
{"command": "split_selection_into_lines"},
{"command": "move_to", "args": {"to": "hardbol", "extend": false}},
{"command": "insert", "args": {"characters": "REM "}}
]
Now you can use it. Select the lines to comment and execute the macro.
You can also bind the macro to a key. Add in "Key Bindings - User" this key binding:
{ "keys": ["alt+."], "command": "run_macro_file",
"args": {"file": "Packages/User/what-you-want.sublime-macro"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.dosbatch" }
]
}
The "selector" key in the "context" ensures that this key is only mapped when in batch files ("source.dosbatch").
References:
Upvotes: 2