5. Common commands

The most common commands used in vim are covered in the Tutor me! section. You did the tutor right? The following sections contain some additional commands.

5.1. Movement commands

Movement commands

G

Move to the end of the file.

gg

Move to the beginning of the file.

CTRL-b

Move back a page.

CTRL-f

Move forward a page.

CTRL-u

Scroll up.

CTRL-d

Scroll down.

Tip

If you don't like the way the scrolling works you can adjust it with the scroll, scrolloff, and scrolljump options. Type :help scroll for more information. The vimrc files section explains how to make these adjustments permanent.

CTRL-e

Expose another line at the top. Useful for scrolling the screen without moving your cursor from its position.

CTRL-y

Expose another line at the bottom. Useful for scrolling the screen without moving your cursor from its position.

}

Move forward a paragraph. Useful for moving through documents which have blank lines separating paragraphs or blocks. An easy way to distinguish between this and { is to remember it points in the direction you wish to go.

{

Move backward a paragraph. Useful for moving through documents which have blank lines separating paragraphs or blocks.

)

Move forward a sentence. An easy way to distinguish between this and ( is to remember it points in the direction you wish to go

(

Move backward a sentence.

:number

Where number is a decimal number indicating the line number you wish to jump/move to.

'0

Vim creates a "bookmark" each time you exit Vim. The last "bookmark" is '0. So if you have a file you haven't edited in a long time and can't remember where you left off simply type this command and it will take you to the place you last edited. You can find out what marks are set by typing :marks.

Reference :help navigation and :help motion for more information on motion commands.

5.2. Search commands

There are several options which allow you to enhance your searching. The hlsearch option highlights the text of the search. The incsearch option highlights and shows possible matches as you type the text. You can get more information on these options by typing :help hlsearch and :help incsearch. The vimrc files section explains how to make these adjustments permanent.

5.3. Simple editing/combination commands

Do you have a simple editing option you use frequently? Please send it to us at newbiedoc-discuss@lists.sourceforge.net so we can add it to this document.