Searches

Command

Action

/pattern

Search forward for pattern.

/

Repeat previous search forward.

/pattern/+n

Go to line n after pattern.

?pattern

Search backward for pattern.

?

Repeat previous search backward.

?pattern?-n

Go to line n before pattern.

n

Repeat previous search.

N

Repeat previous search in opposite direction.

%

Find match of current parenthesis, brace, or bracket.

*

Search forward for word under cursor. Matches only exact words. (vim)

#

Search backward for word under cursor. Matches only exact words. (vim)

g*

Search backward for word under cursor. Matches the characters of this word when embedded in a longer word. (vim)

g#

Search backward for word under cursor. Matches the characters of this word when embedded in a longer word. (vim)

fx

Move forward to x on current line.

Fx

Move backward to x on current line.

tx

Move forward to just before x in current line.

Tx

Move backward to just after x in current line.

,

Reverse search direction of last f, F, t, or T.

;

Repeat last character search (f, F, t, or T).

:noh

Suspend search highlighting until next search. (vim).

Line numbering

Command

Action

Ctrl-G

Display current filename and line number.

gg

Move to first line in file. (vim)

nG

Move to line number n.

G

Move to last line in file.

:n

Move to line number n.

Marking position

Command

Action

mx

Mark current position with character x.

'x

(backquote) Move cursor to mark x.

'x

(apostrophe) Move to start ...

Get Mac OS X Tiger in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.