Sublime Forum

How do I change html comments to jsp comments?

#1

Hi,
in Sublime Text 2 I could change the html comment you get when doing ctrl + 7 (I changed the default ctrl + / to ctrl + 7). I have now upgraded to Sublime Text 3, but I see no option to do this anymore. Could someone explain how I go about changing it to a jsp comment?

To clarify:
When typing ctrl + 7 I want to comment out the code. By default this is a html comment, , and I want to change that to a jsp comment, <%-- … --%>

0 Likes

#2

I’ll reply to myself since I’ve found a solution.

This thread on StackOverflow solved it for me: http://stackoverflow.com/questions/21190392/how-to-change-default-code-snippets-in-sublime-text-3

Only issue I have now is that I’d like to be able to comment out blocks of code instead of just one line. To comment out blocks I need to select the block first. I did not have to do that in ST2. Though I dont remember if I did anything to achieve that there. If anyone knows, please let me know :slight_smile:

0 Likes

#3

I’ve only used ST3 but as far as I know there is no default key combination that would comment out a block without you first telling it what exact block you meant (unless there’s a plugin that does it).

That said there are commands available under the Selection menu that you might be able to use in combination as a macro to do what you want. For example Selection > Expand selection to scope or Selection > Expand selection to indentation.

For example:

[
        // Or one of: bol, hardbol, eol, hardeol, bof, eof, 
        // brackets, line, tag, scope, indentation
	{"command": "expand_selection", "args": {"to": "indentation"} },
	{"command": "toggle_comment", "args": {"block": true } }
]
1 Like