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)

Traversing files (Should know)

This task will teach you how to quickly and easily open files within a project without reaching for the mouse.

Getting ready

Open or create a project with multiple files.

How to do it...

You may navigate to files within your project in two main ways:

  • The Project Drawer menu: This is the most obvious way to select a file to open. Once clicked, the file will open a new tab in the document window.

  • The Go to File... option: From the menu, select Navigation | Go To File… (Command + T).

How it works...

The Project Drawer menu should be self-explanatory as it's simply a list of the files and folders in a project.

If you already know the name of the file you want to open, the Go To File... (Command + T) option saves a great amount of time. When you use this option, a pop-up box will appear with a list of the files in the project, as shown in the following screenshot:

Start typing to filter the files by what you enter in the search box. Press Tab and then the up or down arrow to navigate your selection to the file you wish to open. Press Enter or Return to open the file in the document window and close the Go to File... pop-up box.

There's more...

You can toggle the Project Drawer at any time as well as specify which file extensions you want to open in TextMate.

Show/Hide Project Drawer

From the menu, select View | Show/Hide Project Drawer (Command + Option + Control + D).

The Project Drawer will attempt to open on the left-hand side by default. However, if there's no room, it will open on the right side. TextMate will remember which side it last opened on. So, in a scenario where Project Drawer opened on the right-hand side, was hidden, and then reopened with enough room on both sides, it will open on the right-hand side again.

Treating files as binary

When you open projects, unless you exclude certain files, TextMate will also pull in any images or executables. Though you may not mean to, you can open these files in the document window.

If you'd rather not have TextMate read these files when you click on them (usually by accident), then you can right-click on the files in the Project Drawer and select Treat Files with ".xxx" Extension as Binary. An example of this is shown in the following screenshot:

You can undo this by right-clicking on the file and selecting Treat Files with ".xxx" Extension as Text.