Edit in Textmate on Leopard

Thursday, November 15

After upgrading to Leopard, I noticed that the ‘Edit in TextMate’ command stopped working. This is a neat little hack that allows you to edit the contents of just about any Cocoa text control within TextMate. At first I was like, meh, no big deal. But after living without it for a few weeks, I realized just how useful it is.

A bit of googling revealed the cause: the rules governing Input Managers have changed in Leopard. Fortunately, TextMate creator Allan Odgaard has a detailed post on how to fix this.

http://blog.macromates.com/2007/inputmanagers-on-leopard

Related: SIMBL Hacks

Also affected by the change to Input Managers were some of my SIMBL hacks, specifically, the hack that I used to customize the default colours of Terminal.app: Mike Solomon’s TerminalColors. Being designed for Tiger’s Terminal.app, this wasn’t working for the new Leopard version.

Ciaran Walsh has re-hacked the hack, and I’m happy to report that I can finally read blue on a black background again. Thanks Ciaran!

http://ciaranwal.sh/2007/11/01/customising-colours-in-leopard-terminal

BTW, the new Terminal.app is completely awesome. Finally, a fast, tabbed terminal for OS X.

TextMate tab-triggers for Ruby 1

Thursday, February 01

I’m always forgetting the handy Ruby tab triggers for TextMate. Today I went through them and highlighted a few that you just can’t afford to miss.

r     # => attr_reader :attr_names
w     # => attr_writer :attr_names
rw    # => attr_accessor :attr_names
req   # => require "" 
mm    # => def method_missing(meth, *args, &block); end
am    # => alias_method :new_name, :old_name
:     # => :key => "value", 
doo   # => do |object| end
ea    # => each { |e|  }
patfh # => File.join(File.dirname(__FILE__), *%w[rel path here])

In a related note, I recently purchased the TextMate beta book from Pragmatic. Full of useful tidbits and highly recommended.

All Hallow's Eve

Thursday, October 05

Check out this pretty syntax highlighting! James Wilford was kind enough to contribute it to Scribbish, and I made the colors match TextMate’s All Hallow’s Eve theme.

Here is some random code (from HAML, actually) to show it off:


require File.dirname(__FILE__) + '/engine'

module Haml
  class Template
    def initialize(view)
      @view = view
    end

    def render(template, local_assigns={})
      assigns = @view.assigns.dup

      @view.instance_eval do
        assigns.each do |key,val|
          instance_variable_set "@#{key}", val
        end

        local_assigns.each do |key,val|
          class << self; self; end.send(:define_method, key) { val }
        end
      end

      Haml::Engine.new(template, :scope_object => @view).to_html
    end
  end
end

Syntax highlighting is available in the Scribbish svn repository. Instructions for checking out the code are on the download page.

Two Things I didn't know about TextMate

Friday, January 20

The TextMate Manual was recently published and I made some time today to go through it. I always seem to work with an editor for far too long before I realize there’s some handy shortcut I’ve been ignorant of. Anyways, an editor like TextMate is full of these hidden gems—clever macros and commands that make life easier. Here are a couple of things I didn’t know.

CMD-T: Go to File

Until this moment, I had no idea the ‘Go to File’ window existed, let alone its CMD-T shortcut. I hate taking my hands off the keyboard to click on files in the project drawer, so the ‘Go to File’ command makes my day. It opens a window containing a flat list of all the files in your project, with a live, abbreviation-enabled search.

[This] window lists all text files in the project sorted after last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy last-recently-used switching.

From 2.3 Moving Between Files

CMD-Return: Save some keystrokes

You know how when you type an auto-paried character, like a quote, or a brace, your caret ends up in between the pair? Well, this is generally useful, but really sucks when you’re at the end of a line because you have to move all the way to the end before making a carriage return. You can imagine my excitement when I learned about CMD-Return. CMD-Return will move to the end of the line and insert a newline for you. How great is that?

From 4.1 Auto-Paired Characters