vimlong-lines

Is it possible to move crusor up & down in wrapped long line in Vi?


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


Solution

  • 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.