sponsor Vim development Vim logo Vim Book Ad

basic Tip #48: Moving around

 tip karma   Rating 43/25, Viewed by 2825 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   March 14, 2001 8:36      complexity:   basic
author:   Anonymous      as of Vim:   5.7

You can save a lot of time when navigating through the text by using
appropriate movements commands. In most cases the cursor keys,
<PageUp> or <PageDown> are NOT the best choice.

Here is a selection of some basic movement commands that
hopefully helps you to acquire a taste for more:

e   - move to the end of a word                  
w   - move forward to the beginning of a word    
3w  - move forward three words
b   - move backward to the beginning of a word
3b  - move backward three words

$       - move to the end of the line          
<End>   - same as $
0       - move to the beginning of the line
<Home>  - same as 0

)   - jump forward one sentence
(   - jump backward one sentence

}   - jump forward one paragraph
{   - jump backward one paragraph

H   - jump to the top of the display      
M   - jump to the middle of the display  
L   - jump to the bottom of the display

'm  - jump to the beginning of the line of mark m
`m  - jump to the location of mark m

G   - jump to end of file
1G  - jump to beginning of file
50G - jump to line 50

'' - return to the line where the cursor was before the latest jump
`` - return to the cursor position before the latest jump (undo the jump).

%  - jump to corresponding item, e.g. from an open brace to its
     matching closing brace
  
For some more interesting movement commands (especially those
for programmers) refer to:

:help motion.txt

:help search-commands

 rate this tip  Life Changing Helpful Unfulfilling 

<< Swapping characters, words and lines | Switching case of characters >>

Additional Notes

[email protected], June 19, 2002 4:51
^        move to first non-blank character of the line.
g_      move to last non-blank character of the line.
Anonymous, May 22, 2003 17:54
>1G  - jump to beginning of file
gg is faster
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo