Book Image

TextMate How-To

By : Chris Mears, Christopher J Mears
Book Image

TextMate How-To

By: Chris Mears, Christopher J Mears

Overview of this book

Not all text editors are created equal. TextMate was created with versatility and power to the developer. Whether you want to organize your files in projects, utilize the efficiency of code completion, take advantage of the thousands of publicly available bundles, or gain insight using powerful regular expression searching, TextMate is an essential and easy-to-use tool you need in your development arsenal. "TextMate How-To" is a practical guide filled with conventional recipes on using one of the most popular text editors on the OS X platform. It is a great resource for anyone who wants to learn how to code more efficiently and effectively, no matter what programming or scripting language you use. This book will guide the reader through using TextMate for practical purposes. It will start with configuring the application, then cover navigation and editing of files, and finish with bundles and advanced features. Throughout the book, the reader will quickly master the key features of the application through easy to follow tasks. Using this book, the reader will learn the most common text editing and coding tasks including navigation through the document and searching of text. The reader will then learn about working with and navigating between files and projects as well as utilizing bundles to greatly speed up development. Finally, explore the ability to use shell commands and macros to increase productivity. With just a few hours, "TextMate How-To" will teach the reader everything necessary to hit the ground running with this powerful text editor.
Table of Contents (7 chapters)


TextMate is a highly extensible Mac OS X GUI text editor that has gained quite a bit of developer notoriety through the years. Created in 2004 by Allan Odgaard, TextMate 1 started out as a simple editor. By 2006, when TextMate 1.5 was released, it won the Apple Design Award for Best Developer Tool, and has gained a vast community backing.

In August 2012, TextMate 2 was released under GNU General Public License and its source code is available at Github. However, this guide will cover the most popular version of the software, TextMate 1.5.

The goal of this book is to provide its readers a succinct set of recipes to become familiar with TextMate's most useful features and bundles, in order to hit the ground running and code more quickly and effi ciently.

What this book covers

Configuring TextMate, guides you through the most common configuration topics so you can customize your TextMate experience quickly.

Installing themes, covers downloading and installing themes to personalize your document window and code coloring.

Quickly navigating to text, demonstrates how to navigate the text and document quickly and easily with keyboard shortcuts.

Converting text, provides an overview of the most common built-in text conversions that will speed up your editing.

Moving and aligning text, walks you through how to move and align text in your document.

Manipulating multiple lines and columns of text, provides a very useful recipe for editing multiple lines of text at the same time.

Finding and replacing text, demonstrates TextMate's extremely powerful Find and Replace functionality.

Folding, teaches you how to use Folding to organize code.

Bookmarking, walks you through using bookmarks to quickly navigate to important lines.

Creating projects, covers creating and saving projects through various methods, including opening directories, dragging-and-dropping, and using the command line.

Utilizing tabs, runs you through the various ways to navigate tabs, mostly via keyboard shortcuts.

Traversing files, teaches you how to quickly and easily open files within a project without reaching for the mouse.

Finding text in a project, describes another way to find text, this time searching through your entire project. This task will also include some tips on how to speed up your search and even cover some caveats for larger projects.

Installing bundles with GetBundles, covers the finding and installation of bundles with GetBundles, which is a bundle that allows you to install other publicly available bundles.

Learning and loving bundles, quickly describes the use of bundles, including the beauty of tab completions and how to easily find the bundle item you're looking for along with the tab completion abbreviation or the keyboard shortcut.

Making a TODO list, utilizes the official TextMate TODO bundle to display a to-do list compiled directly from your project using common comment keywords such as TODO, FIXME, CHANGED, and RADAR.

Becoming a Zen Coding master, demonstrates the Zen Coding philosophy and use of the most common bundle items.

Blogging more efficiently, describes how to use a few of the more useful blogging bundles (Blogging and Hyperlink Helper) in order to work more efficiently when offline.

Markdown and Textile, covers both text formats and describes why you may want to use one over the other depending on your project.

Using macros, provides an overview on how to record and subsequently execute macros in your document to speed up common tasks.

Executing shell commands, demonstrates how to run shell commands directly from the current document.

What you need for this book

This How-To guide is for users with a basic understanding of TextMate. You should have TextMate 1.5.x installed.

Who this book is for

This book is geared toward beginner and intermediate web developers and designers who want to speed up their coding. Though TextMate can also work very well as a plain text editor, some experience with a programming or scripting language, whether it's HTML, CSS, PHP, or Ruby, is helpful to understand the depth to some of the examples provided.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "The .tmbundle file will open as a project."

Any command-line input or output is written as follows:

cd ~/Library/Application\ Support/TextMate/Bundles.

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.