简体   繁体   中英

HTML keyboard shortcuts in Sublime Text 2?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM