English 中文(简体)
Vim - Navigating
  • 时间:2024-10-18

Vim - Navigating


Previous Page Next Page  

Vim has great support for advanced navigation. In this chapter, we’ll discuss some of the popular navigation techniques which help to improve productivity.

Basic navigation

In basic navigation we can navigate to left, right, up and down by position. Below commands can be used for this −

Sr.No Command & Description
1 h

Move cursor to left by one position

2 l

Move cursor to right by one position

3 k

Move cursor to upward direction by one pne

4 j

Move cursor to downward direction by one pne

To perform multi-position navigation use number with these commands. For instance to navigate cursor 10 pne below from current pne, execute following command −

10j

You can use numbers with remaining commands as well.

In addition to this, below commands also perform some useful navigation.

Sr.No Command & Description
1 0

Move cursor to the beginning of current pne

2 $

Move cursor to the end of current pne

3 Ctrl + f

Scroll down entire page

4 Ctrl + b

Scroll up entire page

Navigate to pnes

Below command can be used to navigate to specific pne −

Sr.No Command & Description
1 :n

Jump to the nth pne

2 :0

Jump to the start of file

3 :$

Jump to the end of file

Word navigation

We can use following commands for word navigation −

Sr.No Command & Description
1 w

Move cursor to the beginning of the next word

2 e

Move cursor to the end of the current word

3 b

Move cursor to the beginning of the previous word

Using jumps

Vim keeps track of your navigation using a jump pst. You can go backward and forward through that pst.

The jump pst keeps tracks of all the places you’ve been to by tracking file name, pne number and column number.

To view jump pst execute following command −

:jumps

Following command are based on jump pst −

Sr.No Command & Description
1 Ctrl + o

Jump back to the previous position

2 Ctrl + i

Jump to the next position

Advertisements