Book Image

TextMate How-To

By : Christopher J Mears
Book Image

TextMate How-To

By: 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)

Making a TODO list (Should know)


This task will utilize 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.

How to do it...

  • Insert a TODO item by typing a TODO, FIXME, CHANGED, or RADAR keyword anywhere in the comments of your document. You may also use tab completion by typing todo and then pressing Tab, which will automatically create a new comment. The different types of comments are shown in the following screenshot:

  • You can view the TODO list for the current document through the menu by selecting Bundles | TODO | Show TODO List or via the keyboard shortcut Control + Shift + T. The list is shown in the following screenshot:

How it works...

As you may have surmised, the TODO bundle will search through your current document or project for the TODO, FixMe, changed, and RADAR keywords. Note that the keyword is not case sensitive and can be followed by a whitespace character, a comma, or a colon. This is shown in the following screenshot:

To search through multiple files or folders in your project, you need to select those files and/or folders in the Project Drawer menu. For example, to search the entire project select the top-level folder and click on Show TODO List (Control + Shift + T).

There's more...

You may customize the TODO bundle to suit your color and pattern preferences as well as add more markers. We'll also cover the Tasks bundle, which will help you create well-formatted to-do lists.

Setting other preferences

You can choose what words count as TODO keywords. To do this, go to TODO Preferences via the File menu by selecting Bundles | TODO | Preferences. This window is shown in the following screenshot:

You may also change the color and regular expression pattern of the keywords, making this bundle quite versatile.

Tasks bundle

If you love to-do lists, a similar bundle called Tasks is also available for installation via GetBundles. The Tasks bundle allows you to easily create simple to-do items (Ins or fn + return on laptops to create a task) and mark them as complete (Command + D). An example of a to-do list is shown in the following screenshot:

More information on official TextMate bundles

The other official TextMate bundles are extremely helpful. However, this book will attempt to show you bundles and tools about which you might not already be aware. You can read about some highlights of the other bundles in the TextMate manual at http://manual.macromates.com/en/bundles.