HTML keyboard shortcuts in Sublime Text 2?
Solution 1
Mac:
Ctrl+Shift+W
Windows/Linux:
Alt+Shift+W
Then type which tag you want (i
, b
, etc.).
Solution 2
{ "keys": ["super+alt+b"], "command": "insert_snippet", "args": {"contents": "<strong>${0:$SELECTION}</strong>" } },
{ "keys": ["super+alt+i"], "command": "insert_snippet", "args": {"contents": "<em>${0:$SELECTION}</em>" } }
Above can be added to user key bindings file to have selection surrounded by strong tags upon pressing Cmd+Alt+b and by italic tags upon pressing Cmd+Alt+i (on Mac).
Source: https://gist.github.com/3436510
Shpigford
Maker. Dabbler. Founder of Baremetrics. I can't stop starting things. Cedar & Sail, Laser Tweets, Founder Chats, Droptune, Rockburg. Bearded.
Updated on June 03, 2022Comments
-
Shpigford almost 2 years
I switched from Textmate to Sublime in the past few months and have been busy trying to re-train my brain and fingers to use the new shortcut keys.
In Textmate, when editing an HTML documents, I could highlight text and do Command+b to wrap the selected text in
<b></b>
tags or Command+i to wrap in<i></i>
...among various other commands/tags.So, is there a way to do that in Sublime? I know I can type b, TAB to create an empty set of
<b></b>
tags, but I want to be able to wrap selected text in various tags.