
On the Floor
In a Mac environment, one of the favourite text editors for development is Textmate. Some people around the office have migrated to Vim, but I'll let them address that in their own posts.
I've been finding most of these shortcuts by accident. Usually by missing a usual shortcut with an inaccurate keystroke, then sudden, unexplained magic happens.
I've also discovered quite a few while watching Railscasts. If you watch the upper right hand corner of a Textmate shot you'll usually see what sort of shortcut is used to make the magic happen.
Here's a few I use all the time:
Cmd + T : List of most recent files and quick file search
Ctrl + Shift + D : Duplicates you current line/selection
Ctrl + Shift + K : Removes the entire line the cursor is on
Ctrl + Cmd + R : Show the file you are working on in the drawer
Alt + Cmd + Down : Opens the view of the action your cursor is currently in
Ctrl + L : Inserts " => " (in an .rb file)
Cmd + ] or Cmd + [ : Indent left or right
Alt + Cmd + ] : Align assignments within a block
Cmd + / : Comments out the line/selection of code using the appropriate syntax (most of the time)
Cmd + Del : Deletes everything after the cursor
Cmd + Backspace : Deletes everything before the cursor
Tab completion
This, like terminal, works more often than not. Depending on the bundles you have installed and the extension of the file you are coding, hitting tab following some snippet of code may complete what you are doing. You can also continue to tab through the options in blocks that have more than one condition/option/variable.
Loops
Def then Tab : def method ... end
Do then Tab : do |variable| ... end
If then Tab : if condition ... end
Validations
vp then Tab : validates_presence_of :attribute, :on => :create, :message => "can't be blank"
vu then Tab : validates_uniqueness_of :attribute, :on => :create, :message => "must be unique"
vf then Tab : validates_format_of :attribute, :with => /^[\w\d]+$/, :on => :create, :message => "is invalid"
Relationships
bt then Tab : belongs_to :object, :class_name => "Object", :foreign_key => "object_id"
hm then Tab : has_many :objects, :class_name => "object", :foreign_key => "reference_id"
ho then Tab : has_one :object, :class_name => "Object", :foreign_key => "object_id"
Migrations
mcol then Tab : Provides you with the options available for column migrations
mtab then Tab : Provides you with the options available for table migrations
And finally
Ctrl + Cmd + T : To see a list of all bundle items (shortcuts) available to the file you are currently working on
DIY
You can also make your own by recording and saving a Macro. In the menu under Bundles > Macros you can:
Ctrl + CMd + M : Start recording. This will record any keystrokes you make so that you can create your own shortcuts.
Shift + Cmd + M : Replay the last recording to see how it works or just repeat the last recorded action over and over.
Alt + Cmd + M : Record the last recording and assign a shortcut to it.
There are tons of bundles and shortcuts you can add use in textmate and this is only scratching the surface. Give it a shot and see what you find.
REFERENCES: http://szeryf.wordpress.com/2010/02/15/textmate-shortcuts-you-should-be-using/
Subscribe 
Follow us on
Twitter 
Archives
May 2012April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
June 2009
March 2009
January 2009
December 2008
November 2008
September 2008
August 2008









Comments
Another great one that I forgot:
lorem then Tab : Inserts a string of Lorem Ipsum. Great for filler content on the fly.
Add a Comment