TextMate Shortcuts Cheatsheet

→ and ← (option right and left arrow) – jump between words
→ and ← (command right and left arrow) – go to beginning or end of line

↑ and ↓ (option up and down arrow) – jump up and down to beginning and end of same level of indentation section

↑ and ↓ (command up and down arrow) – jump up and down to beginning and end of page

and (option page up and page down), keeps your cursor at center of the screen
fn ↑ and fn ↓ (function-option arrow up and arrow down), keeps your cursor at center of the screen (on laptop)

t (command-t) – Go to File
t (shift-command-t) – Go to Symbol within a file

← and → (command-option left and right arrow) – switches between tabs in textmate

~ (command – ~ tilda) – switch between textmate projects (if you have multiple project windows opened)

(escape key) – used for word completion. type part of a word and then press the escape key to see the different word options.

↓ (option-command-down arrow) – jump between related files
↓ (shift-option-command-down arrow) – jump between related files (model, controller, functional test, unit test and fixture) – if one of the files doesn’t exist, it can be used to generate one for you

Add shift key to any of the above hotkeys.

→ and ← (shift-option right and left arrow) – highlights words

→ and ← shift-command right and left arrow – highlights to end of line or beginning of line

↑ and ↓ (shift-option up and down arrow) – highlight everything above or below cursor

(option-delete) – delete single word to left of cursor

fn (function-option-delete) – delete single word to right of cursor

fn or k (function-command-delete OR control-k) – delete everything to right of cursor

k (shift-control-k) – delete entire line or selection

mate dir1 dir2 – open dir1 and dir2 in textmate project

tcs – create a new column of type string
tci – create a new column of type integer
tct – create a new column of type text
tcb – create a new column of type boolean

Models DB Schema

Inside the model, place cursor on Model name and type: control-shift-command-s to open up a window which displays database schema associated with that model.

Models Associations

hm – has_many (then click tab again to tab through areas you want to customize)
ho – has_one (then click tab again to tab through areas you want to customize)
hmt – has_many :through (then click tab again to tab through areas you want to customize)
bt – belongs_to (then click tab again to tab through areas you want to customize)

Models Validations

t (control-command-t) Then type ‘validate’ to narrow down

Models After-Before Filters

t (control-command-t) Then type ‘after’ to narrow down
t (control-command-t) Then type ‘before’ to narrow down

def – creates a method stub

cla – creates a class stub

: – gives you available options for that particular section. For example, for creating a new route, open up routes file, type map-tab and at the end type :-tab to create key value pairs.

t (control-command-t) and then type “find” (find methods)
p (control-p) – shortcut for params hash to use within find method, for example.
rest – creates respond_to block

defcreate – creates stub for create action.

t (control-command-t) and then type “redirect” for different types of redirect_to methods

rep – redirect_to a path (but first create a route. see below)

t (control-command-t) and then type “map”
map – create a named route.
mapr – create a single restful route
maprs – create nested restful routes

deft creates a method stub for a test

| (control-shift-|) (pipe) – Clone Development DB to Test DB

r (command-r) – run a test. (must be in the test rb file. test db must be created already)

ft – creates a form_tag
ff – creates form_for
ffe – creates form_for with error messages at top of it

use the following with the form_for tags:
f. – provides a menu of different form fields (use this one within the form_for tag)
ffl – creates form label field
fftf – creates form text_field
ffta – creates form text_area
ffcb – creates form check_box
ffrb – creates form radio_box
ffpf – creates form password_field
ffhf – creates form hidden_field
ffff – creates form file_field
ffs – creates form submit field

div – creates a div tag

div – creates a div tag but assume you don’t want to set id, you can type option-escape at that point to see a list of other attributes you can use instead of id.

. (control-shift-. (period)) – gives you <%= %>, <% %>

create a partial by doing: select piece of view and do h (shift-control-h) to

rpo – render partial by passing an object
rpc – render partial by passing a collection

t (control-command-t) – then type link_to to see all types of link_to

VN:F [1.9.22_1171]
Rating: 4.6/5 (14 votes cast)
VN:F [1.9.22_1171]
Rating: +8 (from 8 votes)
TextMate Shortcuts Cheatsheet, 4.6 out of 5 based on 14 ratings
Facebook Twitter Email

6 Comments to “TextMate Shortcuts Cheatsheet”

  1. navid 14 August 2010 at 4:07 pm #

    Thanks Gavin. Fixed the mistake.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  2. gavin 9 August 2010 at 10:59 am #

    nice listing…thanks!!

    i spotted a small mistake: the symbols for “delete entire line or selection” incorrectly show “shift-command-k” instead of “shift-control-k”.

    VA:F [1.9.22_1171]
    Rating: 5.0/5 (1 vote cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  3. Rodrigo 19 July 2010 at 8:04 am #

    How to make fn+right|left arrow acts just like any other app?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  4. navid 3 January 2010 at 5:56 pm #

    Done. Including symbols. Please let me know if you find any typos. Thanks!

    VN:F [1.9.22_1171]
    Rating: 3.3/5 (3 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  5. rob 30 December 2009 at 11:24 pm #

    thanks man!

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  6. jawele 20 December 2009 at 3:08 pm #

    thanks for the good work, just one thing maybe instead of using “command” or “shift” and etc use the apple graphic symbols which are quicker to visualize when working imho…

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply