Topic: Textmate Tips/Tricks/Themes

Hey, I think it would be nice to collaborate a nice list of tips/tricks/themes for textmate users.

I don't really have a vast knowledge of textmate so I am mainly going to wait for people to contribute some, but please put in your 2 cents wink.

http://danielfischer.com - Personal Web-Technology-Blog, Los Angeles.

Re: Textmate Tips/Tricks/Themes

Every time you reach for your mouse, find a way to do it with the keyboard.

Use the command-T, command-shift-T, and command-control-T key combos. You can do almost anything with just those three.

Install "Edit in TextMate" in the TextMate bundle. Very handy!

Create snippets for each CRUD based controller action. It saves a lot of typing if you are doing REST.

Command-option-down arrow and command-shift-option-down arrow are a godsend when navigating a Rails project. If you try to go to a view which doesn't exist, it will allow you to create one.

Use command-tab to quickly switch between TextMate, Terminal and your web browser.

Hold down option key when moving the cursor left and right with the arrow keys to move one word at a time. This is extremely useful when trying to get somewhere within a line. It's much easier to hit the arrow 5 times instead of 20. You can do the same thing when making selections and deleting.

Last edited by ryanb (2006-11-22 13:02:59)

Railscasts - Free Ruby on Rails Screencasts

Re: Textmate Tips/Tricks/Themes

when you want to create a new line. intead of going to the end of the line press command-enter very hand as textmate finishes things off for you, and you quite often find yourself in a line and wanting to create a new one.

creating new defs in controllers
just type the def name and press shift enter

Last edited by BasicMind (2006-11-22 14:26:43)

--

Re: Textmate Tips/Tricks/Themes

option+apple key+period will close the most recent open tag in a HTML/XML/RHTML/PHP/etc. file. Just a little time saver smile

vinnie - rails forum admin

Re: Textmate Tips/Tricks/Themes

Also, in case anyone missed it, use control-shift-period to make an ERB block inside an RHTML file. Hit the same thing again to toggle the equal sign. The control-Z/X combo is being deprecated.

This was added very recently, so you may need to be on the cutting-edge build.

Railscasts - Free Ruby on Rails Screencasts

Re: Textmate Tips/Tricks/Themes

Anyone know of some awesome bundles, etc?

http://danielfischer.com - Personal Web-Technology-Blog, Los Angeles.

Re: Textmate Tips/Tricks/Themes

There's a long list of bundles at this svn repository. You can do a checkout of any of them directly to the textmate bundles repository to quickly try them out. More instructions are at the bottom of this page.

As far as specific bundles, I feel I could use some more Rails ERB specific snippets, but I haven't seen any bundle for this. I guess I'll have to just create my own. smile

Railscasts - Free Ruby on Rails Screencasts

Re: Textmate Tips/Tricks/Themes

I run the "cutting edge" TextMate version. Is there a point in also installing the Rails bundle from the SVN trunk? Anything new in that?

Re: Textmate Tips/Tricks/Themes

I like using the command line to open my project up in textmate. When in your rails app directory you can type

open -a textmate .

This opens your entire framework folders up in textmate in the project draw

10

Re: Textmate Tips/Tricks/Themes

sydneyfx wrote:

I like using the command line to open my project up in textmate. When in your rails app directory you can type

open -a textmate .

This opens your entire framework folders up in textmate in the project draw

TextMate comes with a command-line launcher called mate. It should be in ~/bin.

mate .

The command above should do the same as yours but you'll save half the typing time smile

vinnie - rails forum admin

11

Re: Textmate Tips/Tricks/Themes

Instead of open -a ...

try this:

Bundles > TextMate > Install "Edit In Textmate..."

Then from terminal:

cd /my/project/dir
mate .

Re: Textmate Tips/Tricks/Themes

The Install "Edit in Textmate" bundle is actually different than the command line utility. To install the command line utility go to Help > Terminal Usage....

The Edit in Textmate thing adds a an item to the Edit menu of all cocoa applications. If you are typing in a text field in Safari or some other Cocoa app, just select that menu item or hit command-control-E to start a new textmate document with the content you are typing. Just save it and close it and the text will be inserted back into Safari where you were typing it. Very cool!

Combine this with the BBCode bundle for absolute forum typing bliss.

Railscasts - Free Ruby on Rails Screencasts

Re: Textmate Tips/Tricks/Themes

that is sick!

Re: Textmate Tips/Tricks/Themes

ryanb wrote:

Also, in case anyone missed it, use control-shift-period to make an ERB block inside an RHTML file. Hit the same thing again to toggle the equal sign. The control-Z/X combo is being deprecated.

Thanks for this tidbit..I was actually gonna post here and ask why my old key commands arent working.

As usual you are ahead of the game, player

Re: Textmate Tips/Tricks/Themes

This peepcode screencast was good.

http://www.peepcode.com/products/textma … -for-rails

I've been using textmate for HTML/CSS/PHP stuff for a while now and the most powerful thing that I've learned is to make use of custom snippets and commands.  You can do some REALLY powerful stuff.

Learning keyboard shortcuts is also a great way speed things up.

Re: Textmate Tips/Tricks/Themes

I know this is a little late but what the heck this should benefit somebody smile

I found these cheat-sheets very helpful when getting the hang of rails development in Textmate.

http://pragmaticstudio.com/rails/RailsT … Cheats.pdf

http://feldpost.com/lighthaus/textmate_rails.pdf

enjoy! smile

Re: Textmate Tips/Tricks/Themes

Sorry for digging up this old post, but I was wondering if anybody could send me the textmate_rails.pdf cheatsheet? It is the second url in the post above this one, but the link doesn't work anymore. Google doesn't have it in cache and archive.org has 'technical difficulties'.

Thanks in advance!

Re: Textmate Tips/Tricks/Themes

ryanb wrote:

Command-option-down arrow and command-shift-option-down arrow are a godsend when navigating a Rails project. If you try to go to a view which doesn't exist, it will allow you to create one.

Unfortunately this doesn't work anymore as it looks for a .rhtml file. How could we change that?

Re: Textmate Tips/Tricks/Themes

Johnson wrote:

Unfortunately this doesn't work anymore as it looks for a .rhtml file. How could we change that?

I'm not certain if this will help, but if you update your rails.tmbundle with Dr.Nic's most recent version ( from here ) it should be good to go.

Re: Textmate Tips/Tricks/Themes

I love command B because I really suck at tabbing out my ruby but no matter how messy it gets it makes everything pretty and neat again. Also central shift V is amazing since it allows you to check your ruby syntax.