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.
To start a new HTML page, first create a new file in Sublime Text and save it with the . html extension. This will set the syntax of your document to HTML. Then type !
You can add keyboard shortcuts to your page through HTML with the global accesskey attribute and trigger it with Alt + Shift + key in Chrome and Firefox on Windows, or use Control + Alt + key on Mac.
Sublime Text works with all the standard Windows shortcuts: In addition to the arrow keys, home, end, page up, etc, there is: Ctrl+Left / Ctrl+Right: Move by words. Ctrl+Home / Ctrl+End: Move to the beginning / end of the file. Ctrl+L: Expand selection to line.
Ctrl + D in SublimeText is "Quick Add Next." This appears to be equivalent to Ctrl + B in Brackets, which is "Add next match to Selection" on the Find menu.
Mac:
Ctrl+Shift+W
Windows/Linux:
Alt+Shift+W
Then type which tag you want (i
, b
, etc.).
{ "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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With