21

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?

17 Answers 17

29

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.

2
  • You can also use hg diff | mate - to get a diff of the mercurial repo. Oct 17, 2009 at 8:43
  • 2
    The mate command can also be used on its own: mate foo.txt to open foo.txt in TextMate, and mate . will open the current directory as a project.
    – chuckharmston
    Aug 18, 2010 at 17:13
15

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.

1
  • You can also do regular shift+arrow selections, then tap "alt" to toggle between line selection and block selection
    – dbr
    Oct 21, 2008 at 9:17
11

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

11

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.

1
  • I can't thank you enough for this. I've been using TextMate as my main editor for four months now, but somehow Command+T completely slipped my attention. It's a huge improvement when dealing with a large project!
    – Sol
    Mar 24, 2009 at 9:43
7

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.

5

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

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

5

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.

5

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.)

4

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.

3

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. :-)

3

For me the best features are:

  • Projects - I know every IDE under the sun has this but TextMate makes this useful for all sorts of editing and text processing tasks, and moreover makes navigating around these projects easy without ever lifting your hands from the keyboard. This is huge for Rails or Grails projects or large programming projects with many modules.
  • The excellent syntax highlighting and 'snippets' for myriad languages and tools
  • The excellent scripting language support (Being able to evaluate chunks of Ruby and the like with a single key chord)
  • The built in Blogging bundle is superb. I now use TextMate exclusively for all my blog posts.
  • Columnar editing
  • The ability to use just about any language or tool to extend TextMate, Ruby, Perl, shell, name your poison.
  • An excellent mix of great Aqua GUI support and excellent command line support through the mate and commands, for instance making it easy and pleasant to use TextMate as your default editor for your SCM.
2

Using snippets to expand into large, repetitive blocks of code and then using the tab key to move through and only edit the pieces I need to without having to use the mouse or arrow keys.

1

It's nice and lightweight and has all of the macros built-in for Ruby and let's you run Ruby code, or any other code for that matter just with a keystroke.

1

Check out ProjectPlus, it gives some useful options for the sidebar, it has SCM status badges for svn and git (though I find the git thing a bit buggy).

I like the fact that it can change the sidebar to an embedded panel on left or right (as opposed to the drawer that's default).

1

If, like me, you're borderline OCD when it comes to making code look neat, then Option+Cmd+] to line up all the assignments around the current line is awesome!

0

The mate command line tool is great, you can open an individual file or my favourite use of it is to open a directory of files as a project (e.g. mate .)

0

Checkout Zen Coding bundle . It gives you an awesome productivity boost to developing both HTML and CSS.

Not the answer you're looking for? Browse other questions tagged or ask your own question.