TextMate CheatSheet (Updated)
Shortcuts
Ruby: --------------------------------- :key => "value" - : + tab Navigate: --------------------------------- go to file - cmd - t tab to file (left|right) - opt + cmd + (left arrow|right arrow) select bundle item - ctrl + cmd + t navigate (from controller to view) - opt + cmd + down arrow show methods - shift + cmd + t Views: --------------------------------- create partial - ctrl + shift + H render partial (object|collection|locals) - r + p + (o|c|l) inserting an erb tag <%= %> or <% %> - ctrl + shift + . (cycle) code completion, <h3>foo</h3> - opt + cmd + . 2RMobile Snippets: --------------------------------- <% objects.each do |object| %> 2rmloope <%= object. %> <% end %> |
*** Make the project drawer appear on the left or right.
**
From the menubar select View, then Hide Project Drawer.
Move your TextMate editor window over to the left side of the screen so the project gutter won’t have enough room to open up on that side. (You can move the window all the way to the left if you want, but you don’t need to go that far.)
Select View, then Show Project Drawer, and the drawer will now open on the right side of your TextMate editor.
* Plugins directory is located at
1. /Applications/TextMate.app/Contents/PlugIns/ 2. /Users/rupert/Library/Application Support/ |
http://manual.macromates.com/en/bundles#support_folder
* Installing a bundle.
RubyOnRails Bundle: https://github.com/drnic/ruby-on-rails-tmbundle
RSpec Bundle: https://github.com/rspec/rspec-tmbundle
Cucumber Bundle: https://github.com/aslakhellesoy/cucumber-tmbundle
mkdir -p ~/Library/Application\ Support/TextMate/Bundles cd ~/Library/Application\ Support/TextMate/Bundles git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle" |
Launch TextMate > Bundles > Bundle Editor > “Reload Bundles”
* Identify *.html.erb to open in HTML(Rails)
Read http://blog.macromates.com/2007/file-type-detection-rspec-rails/
rupert:blog rupert$ defaults read com.macromates.textmate OakLanguageFileBindings ( { fileTypes = ( txt ); language = "17994EC8-6B1D-11D9-AC3A-000D93589AF6"; name = HTML; }, { fileTypes = ( builder, rb, erb ); language = "54D6E91E-8F31-11D9-90C5-0011242E4184"; name = "Ruby on Rails"; } ) rupert:blog rupert$ defaults delete com.macromates.textmate OakLanguageFileBindings |
* Identify Gemfiles in TextMate for Ruby on Rails
Read http://efreedom.com/Question/1-3174451/Bundler-Gemfile-Syntax-Highlight-Text-Mate
Include the ‘Gemfile’ as a filetype
fileTypes = ( 'rb', 'rxml', 'builder', 'Gemfile' ); |
* Soft Tabs and Spaces in TextMate
To turn on soft tabs (bottom of the window, in the tab size selector). This will insert spaces instead of tabs, so there won’t be anything to convert when it’s time to save
Source: http://old.nabble.com/Convert-tabs-to-spaces-when-saving–td28891731.html