0

I have this question in my head for quite a while since I started to use vi.

I know that vi can wrap the long line into a nice block, but is there a fast way for us to move 'up' or 'down' in the block (so we dont have to use right/left arrow key and spend 30sec to get to the place we want)?

Thanks

user1948847
  • 955
  • 1
  • 12
  • 27

1 Answers1

5

Just precede your movement command with "g" to ignore the line wrap, eg:

To move down:

gj

To move up:

gk

Also once you're on the right line, then using b and w to move word-by-word is faster than going character-by-character with the left and right arrows.

Magnus
  • 10,736
  • 5
  • 44
  • 57
  • 1
    To expand on this, you could add `nnoremap k gk` and `nnoremap j gj` to your .vimrc, so that you don't have to notice that you're trying to move on a wrapped line. With those mappings, `j` and `k` will always move as desired on a wrapped line. – Travis Northcutt Jun 03 '14 at 00:50