TextMate JavaScript editing tip

I discovered this shortcut while coding some JavaScript in TextMate just now, and mumbled to myself:

OH! F*cking FABULOUS!

Here’s the tip: When editing JavaScript (and presumably other programming languages too) in TextMate, type option-up arrow or option-down arrow to quickly skip to the beginning of the previous or next function.

Very handy!

Ok, two bonus tips (the first one from the excellent TextMate: Power Editing for the Mac by James Edward Gray II):

  1. TextMate includes all the normal spellchecking features that you expect from any text editor on Mac OS X, but adds a brilliant additional keyboard shortcut that allows you to correct spelling without removing your fingertips from the keyboard (and really, what’s better than that, right?).

    Move your cursor to the misspelled word (anywhere within a word that has a red dotted underline noting a misspelling) and type option-F2 to get the same spelling correction popup (with all spelling suggestions and other “learn spelling” options) that you would get when you right click the word with the mouse.

    NEAT!

  2. command-shift-B will select the text within enclosing brackets of any kind currently surrounding your cursor. This is helpful when your cursor is inside of a parenthetical phrase and you want to quickly select the entire phrase (including parenthesis) to cut and paste it elsewhere.

About this entry