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

Quickly navigating to text (Must know)


This task will show you how to navigate the document and text, in most cases without reaching for the mouse or track pad.

How to do it...

The two available options to quickly navigate to the text are as follows:

  • Go to Line... will move your cursor to the specified line number. From the menu, select Navigation | Go to Line… (Command + L).

  • Go to Symbol... will move your cursor to the beginning of a function, method, or other symbol. From the menu, select Navigation | Go to Symbol… (Shift + Command + T).

How it works...

Go to Line... (Command + L) is very useful for situations where you know the precise line you want to edit. For example, when you're debugging some code and the error message code gives the problem line number.

Go to Symbol... (Shift + Command + T) is mainly used for programming languages such as JavaScript and PHP, where functions or methods are defined in the document. When this is invoked, a window will appear with the names of the functions or methods available, as shown in the following screenshot:

Start entering the method name and it will match and filter the list based on what you enter. Go to Symbol... (Shift + Command + T) is extremely helpful for long documents of code where scrolling and navigating line by line is unreasonable.

You can also open the function pop up in the status menu (located at the bottom of the document window) to display all of the functions or methods in your document. This is shown in the following screenshot:

There's more...

Along with the quick navigation shortcuts, there are also ways to move the cursor and scroll the document easily without using the mouse.

Cursor movement

The following keyboard shortcuts will move your cursor:

Shortcut

Description

Shift + F

One character forward.

Shift + B

One character backward.

Shift + P

Up one line.

Shift + N

Down one line.

Shift + A

Beginning of line.

Shift + E

End of line.

Option + right arrow

Right one word (Mac convention).

Option + left arrow

Left one word (Mac convention).

Note that the first four movements can be accomplished by using the arrow keys, but sometimes it's faster to keep your fingers on the keyboard home row.

Scrolling the document without moving the cursor

In the situation where you want to take a peek within the document without moving the cursor, you can use the keyboard shortcut Command + Option + Control plus the arrow keys. For example, to scroll up, you would press Command + Option + Control + up arrow. Your cursor will stay put and you can go back to it by using the Command + J (that is, select Edit | Find | Jump to Selection) keyboard shortcut.

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