Reader small image

You're reading from  TextMate How-To

Product typeBook
Published inOct 2012
Reading LevelIntermediate
PublisherPackt
ISBN-139781849693981
Edition1st Edition
Languages
Right arrow
Author (1)
Christopher J Mears
Christopher J Mears
author image
Christopher J Mears

Chris Mears lives in San Francisco and is the lead web developer at Canned Banners, a startup he co-founded. Though he considers himself a generalist when it comes to technology, he finds true passion developing for the Web. When he's not thinking and dreaming about code, he enjoys going to concerts, practicing on his guitar, homebrewing beer, and tea snobbery. This is his first book.
Read more about Christopher J Mears

Right arrow

Configuring TextMate (Must know)


This task will quickly go through some of the more helpful configuration options, including some Preference and View settings. Note that these settings are purely my preferences and are only meant to show where to find them. You should set up TextMate however you feel comfortable, and based upon your particular project.

How to do it...

To configure Line Numbers:

  1. From the menu, select View | Gutter | Line Numbers (Option + Command + L) to toggle them on and off.

To configure Soft Tabs:

  1. From the status bar, located at the bottom of the document window, click on the Tab Size pop-up menu, and select Soft Tabs.

  2. From the same pop-up menu, select the desired tab size (usually 2 or 4).

To configure Soft Wrap:

  1. From the menu, select View | Soft Wrap (Option + Command + W).

  2. To choose the width of the wrap, from the menu select View | Wrap Column. Selecting Use Window Frame will change the wrap width depending on the overall width of the document window.

To configure the Show Invisibles option:

  1. From the menu, select View | Show Invisibles (Option + Command + I). Two examples are shown in the following screenshot:

To configure Check Spelling as You Type:

  1. From the menu, select Edit | Spelling | Check Spelling as You Type (Option + Command + ;).

Selecting Highlight current line, Show right margin indicator, and Highlight right margin:

  1. From the menu, select TextMate | Preferences (Command + ,).

  2. In Preferences, under the General tab, check Highlight current line, Show right margin indicator, and Highlight right margin.

How it works...

Now, let's go through why you may want to use these settings:

  • Line Numbers: They are helpful to establish where you are in a document. If you'd rather have fewer margin distractions, then you can also determine your cursor's current line and column position in the status bar at the bottom of the document window.

  • Soft Tabs: Soft tabs versus hard tabs are somewhat controversial (do a Google search and you'll see). You should really use what you're most comfortable with or what conforms to the project or document style rules.

  • Soft Wrap: This will wrap lines based on your margin column width settings. If this is not set and there's a line that goes beyond the document window's view, scrolling will be necessary to view the rest of the line.

  • Show Invisibles: This will show tabs and line returns. Sometimes, this is helpful for troubleshooting some oddities in your document, such as why a tab isn't lining up properly. They are also helpful to get a complete picture of your code. However, if you would rather not have the clutter, it's perfectly reasonable to turn this setting off.

  • Check Spelling as You Type: This will provide the familiar wiggly red line under misspelled words. Right-clicking on the words will provide alternate word options. It's only necessary when composing written words, but TextMate is smart enough to determine when you're writing code and won't try to spell check everything.

  • Highlight current line: This will provide a horizontal highlight to indicate in which line your cursor is located. The right margin indicator option will provide a vertical line to indicate the right margin, and the Highlight right margin option will highlight the right margin. These visual indicators, or ornaments, will help show you where your cursor is in the document, as well as where the right margin is located. Knowing where the right margin is can be helpful for keeping code readable and well styled. For example, if some of your fellow coders are accessing the files via shell editors (that is, vim, emacs, nano, and so on), they may have limited document width based on their particular terminal program.

There's more...

Included with the TextMate application is a command-line tool, which can be used in Terminal to open files. In addition, it's quite important to learn the keyboard shortcuts, which will help you do things quickly and efficiently. However, in order to learn the shortcuts, it is vital to learn what the keyboard symbols look like.

Enhanced Terminal Usage

When you run TextMate for the first time, you will be prompted to install the shell command mate. Installing this tool will allow you to open files into TextMate from Terminal, for example, mate example.html or mate project/. There is more on opening files in the Traversing files recipe.

You can open the install dialog at any time from the menu; select Help | Terminal Usage.

Keyboard shortcuts

TextMate is most powerful when you use keyboard shortcuts as opposed to reaching for the mouse and selecting menu items. This How-To will try to provide the keyboard shortcuts for as many of the functions as possible.

Previous PageNext Page
You have been reading a chapter from
TextMate How-To
Published in: Oct 2012Publisher: PacktISBN-13: 9781849693981
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Christopher J Mears

Chris Mears lives in San Francisco and is the lead web developer at Canned Banners, a startup he co-founded. Though he considers himself a generalist when it comes to technology, he finds true passion developing for the Web. When he's not thinking and dreaming about code, he enjoys going to concerts, practicing on his guitar, homebrewing beer, and tea snobbery. This is his first book.
Read more about Christopher J Mears