→ 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 screenfn
↑ 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 youMake a Selection
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 cursorDeleting
(option-delete) – delete single word to left of cursorfn
(function-option-delete) – delete single word to right of cursorfn
or
k (function-command-delete OR control-k) – delete everything to right of cursor
k (shift-control-k) – delete entire line or selectionOpening Project from Command Line
mate dir1 dir2 – open dir1 and dir2 in textmate projectShortcuts within Migrations
tcs
– create a new column of type stringtci
– create a new column of type integertct
– create a new column of type texttcb
– create a new column of type booleanShortcuts within Models
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 downModels After-Before Filters
t (control-command-t) Then type ‘after’ to narrow down
t (control-command-t) Then type ‘before’ to narrow downModels, Controllers, Helpers, Modules, Classes
def
– creates a method stubcla
– 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.Models and Controllers
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 blockControllers
defcreate
– creates stub for create action.
t (control-command-t) and then type “redirect” for different types of redirect_to methodsrep
– redirect_to a path (but first create a route. see below)Routes
t (control-command-t) and then type “map”map
– create a named route.mapr
– create a single restful routemaprs
– create nested restful routesTests
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)Views
ft
– creates a form_tagff
– creates form_forffe
– creates form_for with error messages at top of ituse 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 fieldfftf
– creates form text_fieldffta
– creates form text_areaffcb
– creates form check_boxffrb
– creates form radio_boxffpf
– creates form password_fieldffhf
– creates form hidden_fieldffff
– creates form file_fieldffs
– creates form submit fielddiv
– creates a div tagdiv
– 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 objectrpc
– render partial by passing a collection
t (control-command-t) – then type link_to to see all types of link_tohttp://ionrails.com/2009/09/23/textmate-shortcuts-cheatsheet/
No comments:
Post a Comment