About Linux FAQ

Browse More FAQs:

Moving Around With vim (keyboard short cuts)

Posted by Vivek Gite [Last updated: May 21, 2008]

This FAQ is part 8 of 9 in the series VI / VIM Text Editor

This is a user contributed FAQ.

Q. Can you tell me few useful vim text editor keyboard short cuts for moving around while editing text files?

A.
Moving around with vim.

Open any file, for example
$ vim /etc/httpd/conf/httpd.conf

1. Go to the first line
gg or 1 shift g or :0 (zero) Enter

2. Go to the last line.
Shift g or :$ Enter

3. Go to line 8
8 shift g

4. To scroll down one screen
Ctrl f

5. To scroll up one screen
Ctrl b

6. First position on line
0(zero)

7. Last position on line
$

8. Go to matching parenthesis
%

9. Right, left, up, down respectively.
l, h, k, j
Or You can also use arrow keys

10. Where Am I?
Ctrl g
Note: previous command works in command mode

11. You can see a nice summery of more vim commands here.

This article / faq is contributed by Yoander Valdés Rodríguez (yoander). nixCraft welcomes readers' tips / howtos.

Navigation for VI / VIM Text Editor«vi / vim Auto complete File Name While Editing FilesHow do I Be More Productive In Vim?»

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Stanislav Lechev [AngelFire] Says:

    for point 3 you can use :8 as well (like :0 for the 1st line)

    for point 9 (l, h, k, j) are alternatives for the arrows, it’s easies to use arrow keys…

    one more thing… you can hit 7 and then down/up/left/right to move 7 lines/chars in that direction

  2. chika Says:

    try this

    :set number

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.