Handy TextMate Shortcuts

TextMate (and most other modern text editors) is organized into language 'bundles'. Most of the shortcuts and functions we'll use are part of the HTML Bundle. You can view all the HTML Bundle shorcuts in TextMate by going to the Menu Bar > Bundles > HTML. Other bundles that you might want to investigate are CSS, Hyperlink Helper, and Text.

Here's a list of some common TextMate shortcuts.

Note: the cmd key is the name for the Apple key

TextMate Shortcuts
Keyboard Command Description
! > ctrl+e

Adds the HTML5 template code.

Keyboard sequence is: type '!'. Then, with the mouse cursor immediately after the !, press ctrl+e

option+tab / option+shift+tab
or
cmd+} / cmd+{
Indent or Un-indent the selected text block
ctrl+shift+w

Wrap the selected text in opening and closing tags. By default the tag will be a <p> but you can type in any tag and it will add it to both opening and closing tags.

ctrl+shift+cmd+w

Wrap each line in the selected text in opening and closing <li> tags. By default the tag will be a <li> but you can type in any tag and it will add it to both opening and closing tags for each line.

ctrl+shift+l

Wrap selected text in a <a> tag.

This command will use whatever is in your clipboard and automatically add that as the attribute value for the href. If you have an absolute URL in your clipboard, TextMate will attempt to use it to look up the page title of that page and use that for your link title value.

Press tab and type to move the cursor through the href value, title value, and link text.

cmd+&

Use HTML Entities. A contextual menu will pop up and can type the corresponding number or select it with the mouse.

1. Convert the selected text to entities

4. Insert entity. Will give you a menu to scroll through to find the correct entity to insert.

[tag name] > tab

Create opening and closing tag. Depending on the tag, this may also add common attributes.

This works for many, but not all tags. To see a complete list, go to Menu Bar > Bundles > HTML > Insert Tag.

[lorem] > tab Insert a chunk of lorem ipsum text
ctrl+shift+v

Validate the current page