What are some useful TextMate features?


Question or issue on macOS:

I noticed that many people here use TextMate for coding on OS X. I’ve recently started using it, and although I like its minimalistic interface, it makes it harder to stumble upon cool features if you don’t know what you’re looking for.

So, what feature have you found most helpful for coding (mainly in Python)? Are there any third-party bundles I should know about, besides what’s included?

How to solve this problem?

Solution no. 1:

Don’t neglect the ‘mate’ command line tool. You can use it to pipe output into TextMate, so if you do the following…

diff file1.py file2.py | mate

…it will not only open in TextMate, but it is smart enough to know that you’re looking at a diff and highlight lines on screen.

TextMate’s SVN integration is great; it also seems to have bundles for some other version control systems as well.

Add GetBundle to browse the bundle repository. I found the jQuery bundle through it and it’s very handy.

As others have mentioned, rolling your own bundle for frequently used snippets is very helpful. If you have some snippets that are specific to a project or framework, you might want to prefix all of them with a common letter to keep the namespace tidy.

Solution no. 2:

Holding down option while dragging allows you to highlight a block of text. If you type while the highlight is active, your keystrokes appear on multiple lines.

Solution no. 3:

Being able to write simple commands in any scripting language and bind them to a context-specific hotkey.

Solution no. 4:

The Navigation menu commands Go to File (Command + T) and Go to Symbol (Command + Shift + T) are both extremely helpful.

Go to File, which works when you have a project open, lets you type any part of the file name to see only files that match what you’ve typed.

Go to Symbol has the same type-to-filter interface, but operates on what I’d call the basic block elements of your document. For example, if you’re editing a class, Go to Symbol works on the method names, but in a CSS document, you’ll be searching on your selectors. It’s pretty awesome.

Solution no. 5:

I mention some in a review on Boagworld, I find the snippets, project manager, columnar editing (hold down option while selecting stuff or push it after having selected stuff) and CSS scopes for syntax.

Solution no. 6:

I like the integrated HTML/XML Tidy. Cmd-shift-H is your friend.

Also, nice integration with a variety of scp/sftp clients.

Solution no. 7:

My favourite two features are auto-completion (bound to ⎋ [esc]), and column editing (bound to ⌥ [alt]) both of these things save me quite a lot of time, and are definitely ‘robot ninjas‘.

The book linked above is also a really useful into to the power of TextMate, although it doesn’t specifically mention python.

Solution no. 8:

Don’t forget “Drag commands”.
They give you the ability to drag, say, an image into a blog.html document and will then upload it to the proper folder and insert the markup for you.

Here is another example of how you can expand further on drag commands if you pair TM up with QuickSilver.

(Disclaimer: I wrote the blog post I linked to there. I still think it’s cool though.)

Solution no. 9:

It is worth noting here that there is a Windows alternative to TextMate called E Text Editor. It does pretty much everything TextMate does (apart from macros, but the author is working on this, I think), and even – shock, horror – does some things better, such as the superb bundles editor, the bundles manager, and the branching undo history. Update: and now there’s Snippet Pipes.

So, not exactly a useful feature of TextMate as such, but very useful to know if you’re a fan of TextMate and you have to use Windows for whatever reason.

Solution no. 10:

The ease of snippet creation.

It’s trivial to create new snippets that can accomplish a lot using replacements, tabbing order, and regex substitutions. Quickly assigning these to the tab key for specific languages makes me more productive. And makes me worry about code bloat. 🙂

Hope this helps!