Gabriel L. Oliveira
Gabriel L. Oliveira

Reputation: 4072

Move through long line with up and down keys in vim

Given I have a long phrase, say, in line :12, as this "example":

11 foo bar
12 aasdf aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
13 another line
14 and another line

In vim, the :12 line would be "splitted", but, given my cursor is located as pointed in this "situation":

12 aasdf <MY CURSOR IS HERE>
   aaaaaa.......
   aaaaa...zzzzzz..
   zzzzz....
13 another line

When I press <down> key my cursor would go to :13 line.

I'd like to walk through the long line using up and down keys, as other text editors, and not just jump to next line.

Could anyone help? Thanks in advance!

Upvotes: 2

Views: 106

Answers (1)

Edson Medina
Edson Medina

Reputation: 10289

Use the commands gj and gk.

Also, pressing g<down arrow> or g<up arrow> will do the same.

Upvotes: 3

Related Questions