TextMate tip: Merging bundle changes

I think it's safe to say TextMate is now my main text editor. I bought it years ago, but never really fully jumped on the bandwagon, only using it for random text editing, not web development. I've been using Coda pretty much since it came out, and although Coda is a great piece of software, its text editor just isn't cutting it for me anymore. I've had the TextMate book for years, and finally started reading it recently – the book is great, and I've been missing out.

The following tip is in the TextMate documentation, by the way. No big secret.

“Pristine Copy” explained

If you double click a TextMate bundle or bundle item, or drag it into TextMate, it will be stored in ~/Library/Application Support/TextMate/Pristine Copy/Bundles. This confused me at first, but once you understand how it works, it's a great system.

If you keep all third-party bundles in "Pristine Copy", TextMate stores any changes (deltas) you make to the bundle (even if you just change a keyboard shortcut or the contents of a snippet) in ~/Library/Application Support/TextMate/Bundles as .tmDelta files inside of the .tmbundle package.

This way, if one of your bundles gets updated, you simply update the copy in "Pristine Copy" by manually replacing the bundle file there, or double-clicking the new bundle. Your bundle gets updated, and any changes you've made to the bundle (your deltas) are preserved.

Merging your changes with a pristine copy

But let's just say you'd like to contribute to a bundle, or simply share your customized bundle with the world. You can merge in your changes manually by editing the .tmbundle package and opening up the .tmDelta files if you like, but there's an easier way!

It's almost maddeningly simple:

  1. Open TextMate's Bundle Editor

  2. Drag the bundle to the (Path) Finder.

This is something that I just found out after manually merging a bundle, so I thought I'd share, in case anyone else missed the memo! You can also drag bundle items from the Bundle Editor.