Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
TextMate bundle providing syntax highlighting for Clojure
Clojure
branch: cake

This branch is 7 commits ahead, 3 commits behind swannodette:cake

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Commands
Preferences
Support
Syntaxes
README.md
TODO.txt
info.plist

README.md

textmate-clojure

A TextMate bundle providing syntax highlighting for Clojure.

Based on a previous Clojure bundle by stephenroller.

Install with:

$ cd ~/Library/Application\ Support/TextMate/Bundles
$ git clone git://github.com/swannodette/textmate-clojure.git Clojure.tmbundle
$ osascript -e 'tell app "TextMate" to reload bundles'

Cake Integration

This fork adds quite a few commands via cake which makes the TextMate experience considerably more "Lispy".

First you need to install cake.

sudo gem install cake

If you already have cake installed make sure you have at least version 0.4.0.

Once installed you can create a file and select the Clojure mode. You should first run cake repl at the command line before running any of the Clojure mode commands in order to avoid any weirdness. In general this is the recommended way of working. A quick tutorial follows in the next section.

The commands:

  • Eval : will evaluate the selected code in the current REPL for the project directory.
  • Eval pprint : like Eval but pretty-pprints the result.
  • Load File : load the entire file into the current REPL.
  • Show Source : shows the source of the selected function in a new window.
  • Macroexpand : macroexpands the selected s-expression.
  • Macroexpand all : fully macroexpands the selected s-expression.

REPL Style Development

Coding in Lisp is a very interactive experience. Even if you are used to other languages that have good REPLs (Python, Ruby, Haskell), none are quite as interactive as a competent Lisp REPL.

First launch Terminal.app and run the following in a new window:

cake repl

After a couple (or several) seconds you should get a REPL. If you've already run this command once before you should be dropped into a REPL immediately. Only the first time will be slow.

Create a new file and select the Clojure mode in TextMate. Type in the expression (+ 4 5). Select this and run the Eval command (Command-Shift-X). You should get a new window with the number 9 in it.

Tips

In order to get proper word movement in Clojure you might want to set your Word Characters to _/-.: in the Text Editing tab of the TextMate Preferences window.

For an even more SLIME like experience you could install Visor so that switching to the REPL is just a key-stroke away.

Something went wrong with that request. Please try again.