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)

Installing bundles with GetBundles (Must know)

Installing bundles can be a bit daunting if you're not used to working in the Terminal. This task will cover finding and installing bundles with GetBundles, which is a bundle that allows you to install other publicly available bundles.

Getting ready

Installing GetBundles is much like installing bundles manually, which we will go over later in this task. It's more complicated than installing themes and requires you to use the Terminal application. The steps to install are as follows:

  1. Open the Terminal application, which is located in your Applications folder under the Utilities folder.

  2. From the Terminal, enter the following commands:

    mkdir -p ~/Library/Application\ Support/TextMate/Bundles
    cd ~/Library/Application\ Support/TextMate/Bundles
    svn co
    osascript -e 'tell app "TextMate" to reload bundles'
  3. Now that you have GetBundles installed, you can open the GetBundles window via the menu by selecting Bundles | GetBundles | Get Bundles.

How to do it...

Once you open the GetBundles bundle, you can install any bundle by selecting one or more bundles and clicking the Install Bundles button:

How it works...

The GetBundles bundle has a simple interface that lists bundles and their descriptions with the search option, filters, and tools:

Some of the features of GetBundles are explained in the following section:

  • Filtering: This allows you to filter the bundles by Official, Under Review (as in under review by Macromates), 3rd Party, and All.

  • Searching: You can search for a bundle using two methods—literal or with a regular expression. The search will apply to the current filter you have selected. It will also search both the bundle name and the description.

  • Tools: The tools drop-down menu (that is, the gear icon in the bottom left-hand side of the window) will allow you to use options such as Reload Bundles List, Refresh Local Bundle List, Install all Updates for your currently installed bundles, view the log, and more. You can also see information about the bundle, show the currently installed bundles in Finder, and open the bundle source in Textmate with the icon tools located at the top of the GetBundles window. The tools drop-down menu options are shown in the following screenshot:

  • Installed bundles: All properly installed bundles have a status of Ok.

  • Sorting: All the columns in the bundle list are sortable. For example, if you want to sort by installed bundles, click on the Status column header until the arrow is pointed down, as shown in the following screenshot:

  • Uninstalling bundles: Removing bundles is as easy as selecting an installed bundle and clicking the Delete button, which is shown in the following screenshot:

There's more...

If you'd like to install bundles manually, you can check out the source files directly from Macromate's subversion repository.

Installing bundles via Github or SVN

If you're comfortable using the Terminal, you can manually install bundles using subversion (SVN) or git (via Github):

  • Subversion (SVN): The official TextMate bundles can be found in an SVN repository hosted by Macromates at

  • Git: The official TextMate bundles are mirrored on Github at TextMate bundles are typically listed in Github. Since it's a common convention, search the site for repositories with tmbundle in the name.