MetaSkills.net

TextMate, by Programmers, for Efficiency Experts

Posted On: December 22nd, 2005 by kencollins
TextMate Logo

About a year ago a fellow co-worker of mine was raving that I should learn VIM from the command line interface (CLI) so that I could use it for all my text editing needs. My co-worker at the time was (and probably still is) the Systems Administrator and Lead Application Developer for a company that sold cheap discount software. During my tenure there I served as the Marketing Manager and as such, many of my projects to completely overhaul their search engine and online marketing strategies called for aligning their internal tools and processes. While doing said technical revamps and specification writing, I guess I was exposed as more of a geek than your typical marketer. Hence the recommendation to go further down the rabbit hole. DISCLAIMER: before I go any further -- I would like to say, yes, that link up there is a shameless plug and is meant only to help in the organic search strategies for PlanetCDROM.com. OK, I feel better.

Down the Rabbit Hole?

So did I do it? Am I using VIM and did I even code this XHTML in such an arcane system? The answer is no, but I will admit that I love the CLI from a UNIX operating system. In fact, I will be writing another installment on how to tweak and customize your shell environment.

The main reason I did not learn VIM is because it goes against my technical MO which is also the main theme of this website -- that working at a higher level is better than keeping your head in the trenches. Sure tried and true pays off sometimes, but technology moves fast and there evolves better ways. VIM stays to far down the path of the harder, at least for me anyway. I typically like to get into the details only enough, so that I can figure out a better way of doing things. VIM would have made a good choice to learn if I was forced to work in a Windows environment where my only escape to the UNIX-style world was shell access to a Fedora Core operating system, but hey, that's not the case. I like to advocate working and hosting on Macs and that's a convention all to itself.

Die VIM, Die! Enter TextMate.

OK, now I'm going to say it and say it only once. Using TextMate from the Mac OS X is pure "Convention over Configuration" one of the founding principles of agile software development. I know many don't like the hype of this methodology, especially when used to discuss Ruby on Rails application development but I think these are the same people that like working harder, not smarter and I'm sure they said the same thing about PHP six years ago and also think JAVA is the only way of programming. So we can ignore them, I choose to. So here are a few of the marketing reasons about why I choose TextMate as my editor over BBEdit on the Mac OS.

Column Typing - I love clean organized code and this image snippet shows that editing clean organized code is really easy in TextMate which keeps you from performing the same change across multiple lines.

Column Typing in TextMate

Collapsible Foldings - Use these to hide method definitions, class files, tables, DIVs, or any of your markup that you want out of view. I have also found this especially helpful when editing or viewing very large XML files. HINT: You can old down the option button to fully collapse and expand the foldings. Option-collapse to hide everything and then open up the folding like normal and it will easy you in tag by tag.

Collapse Content in TextMate

Syntax Highlighting - Not just for the whole document, but nested markup too. TextMate does this better than any program I've seen and it does it really well for a huge amount of different file types, even shell scripts. This task was a huge chore in BBEdit. HINT: When you download TextMate, don't stop there. Install Subversion on your system and download the trunk files to get all the bundles. This not only gives you more syntax highlighting, but more actions too.

Syntax Highlighting in TextMate

Tabbed Navigation & Project Drawers - This was another chore in BBEdit and by now most applications are figuring out that tabbed navigation is a must for every program. HINT: One of the things I really like about using the project drawer, which comes up automatically if you drag a folder onto TextMate, is that you can create custom environment variables for the project that talk directly to your shell environment. These could be custom paths, etc.

Tabbed Files in TextMate

That's just a small excerpt from their their website on why TextMate is so great. There are many more and I have only really started to scratch the surface on using it. Here are a few more that directly relate to how I use it.

Man oh Man.

TextMate links directly with your shell environment. That means you can run scripts and code directly from the editor. It even has an HTML output window. I am constantly reading the man pages for all the UNIX software that comes on OS X. Rather than doing this in the shell, I select the command or application name from within TextMate and it pops up the manual page in a nice searchable HTML window. For instance, rather than using man dig or man rsync from the terminal, just select it in TextMate and hit Control-H.

It's all Hallow's Eve

What can be cooler than a built in theme called "All Hallow's Eve". This theme is the typical black background with high contrast code and markup that you see in many of the screenshots for TextMate. Many VIM'ers loved this setting for legibility and its built right into Textmate.

What's the Difference?

Diffs are great and tell you a lot. I really only discovered them because TextMate offers such a simple way of using them. In this example I can show the differences in the configuration of a 2621 Cisco router. This really helps sort things out.


TextMate DIFF Example

Lastly, I would love to hear why some other people have moved to using TextMate or perhaps you may have an example of another editor that is the end all for geeks like us?

bhb

  HOMEPAGE  | January 5th, 2006 at 05:48 AM
bhb Just wanted to say awesome job on the site design, I like it. Also wanted to give a :thumbsup: on your choice of editors. TextMate is an extremely useful editor that is fast, lightweight, and very configurable. Truly is the missing OS X editor! (It just works.) It's my pleasure to turn you on to another great theme for TextMate that you are almost certain to compare against Hallows Eve. It's called Vibrant Ink, and can be downloaded here. Enjoy! (and keep up the great work!)

Andy

  HOMEPAGE  | March 14th, 2006 at 11:37 PM
Andy If you're using TextMate you're using a Mac. If you're using a Mac, and are using TextMate, you're probably the sort of person who's installed Apple's developer tools.... in which case, I urge you to have a play with FileMerge (in /Developer/Applications/Utilities) for comparing changes to files. It will blow your mind !

Ken Collins

  HOMEPAGE  | March 19th, 2006 at 09:36 AM
Ken Collins Well I'm not sure if the author has changed some color schemes or perhaps my eyes are just getting so bad that I need the contrast boost, but I am now using the Vibrant Ink bundle. It really does shine in when coding Ruby and RAILs classes.

Max

  HOMEPAGE  | March 29th, 2006 at 01:31 AM
Max I've watched the screencasts. I've seen the Subversion integration. I've seen the Rails and Textmate cheatsheets. I'm moving to a Mac and getting TextMate. I like Emacs. I like Linux. I'm keeping them. But I can get a puny iBook and have a rad time. Posts like this just make it seem so obvious!

Eric O'Brien

  HOMEPAGE  | April 3rd, 2006 at 09:04 PM
Eric O'Brien You wrote "For instance, rather than using man dig or man rsync from the terminal, just select it in TextMate and hit Control-H." How do you get this to work consistently? I *swear* that it happened once for me, and now never again. The source consulted when you press ^H seems to depend on what language the current document is tagged as. w3.org doesn't know what "SSH" means, for example. I tried changing the language tag to Perl or C but that didn't give me results from man either. Any thoughts?

Ken Collins

  HOMEPAGE  | April 4th, 2006 at 04:16 AM
Ken Collins Those are the two that I use the most. So when you are shell scripting, you get man pages. But most of the time too, I have a "scratch" plain text window open, sometimes for cut and copying text and also for man pages. Hope that helps. Also, have you done a subversion checkout of the bundles?

Eric O'Brien

  HOMEPAGE  | April 6th, 2006 at 08:04 AM
Eric O'Brien Ken asked "...have you done a subversion checkout of the bundles?" Nope. Using a plain text window, ^H give me a tool tip reading Couldn't find documentation for "ssh" (or whatever command I entered. Hmm.

Ken Collins

  HOMEPAGE  | April 8th, 2006 at 08:12 AM
Ken Collins

You know, this was a very interesting problem. Sure enough in my TextMate too (OS X 10.4.6) all the man pages stopped working. Here is what I found out. Go inside the bundle editor, go to the commands for "Unix Shell", click on the one labeled "Documentation for Word / Selection (man)". In here, if I removed this line below my man pages started to work again

export MANSECT=2:3:4:5:6:7:8:9 # exclude shell commands

On another note, while searching the TextMate lists, I found this interesting utility called Bwana. It will show all the man pages linked together in safari. Good god is this bad ass! I really suggest checking it out too.

http://www.bruji.com/bwana/

Eric O'Brienq

  HOMEPAGE  | April 11th, 2006 at 09:47 PM
Eric O'Brienq Huh! Well, that worked for me also. Can you say what clued you in to this being the problem? Other than just randomly deleting stuff? :) Yes, I know of Bwana. A cool program. Looking up a man page while working in TextMate is certainly not something I do very often (since I'm mostly using TM to edit web pages!) but since I was "supposed" to be able to do it, I wondered why it didn't work! Thanks! My next TextMate mystery is why control escape does nothing (it is supposed to evoke the "gear" menu). It works in a newly-created account, so I'm guessing "something" that I've added to my main account has "stolen" that keybinding. Although I have yet to find any other place it does anything, or any preferences dialog that mentions that shortcut. I wish there was a solution other than brute force to figure this one out!

Ken Collins

  HOMEPAGE  | April 12th, 2006 at 08:20 AM
Ken Collins I figured it had to be in there somewhere. So I coped out that command into a TextMate shell doc and started executing it in different fashions to see what that script did. I excel in taking things apart. Creating new things is hard work for me :) Perhaps you should try whacking your TM prefs in your ~/Library/Preferences to see if that helps with your other problem. Maybe even rebuilding your /Library/Application Support/TextMate directory.