0

I have a file with only one single line of content inside, but this line is very very long. When I open it up in Vi, it fills up the whole screen.

How could I move the cursor by number of words or bytes so I can see the content of the next 'page'.

2 Answers 2

5
  • If your goal is to navigate down a single wrapped line, you should consider using g before motions. For example:

    • gj: go down one line visually
    • g8j: go down 8 visual lines
  • You could also move to a specific index in the line with |, e.g. 10| to go to character 10 (one-indexed).

  • w will move you over words (delimiting with certain punctuation), while W will move you over whole words, not counting certain punctuation. Combine with number prefixes to "scan" around.

If you'd prefer not to see your text wrapped and filling the screen, you can call :set nowrap and move with standard motions (e.g. w and W for moving words). Moving the whole window, with zl, zh, zj, and zk are options too.

3

Pressing l takes you to the next character. Pressing w takes you to the next word. If you prefix those with a number, you can specify how many words or characters you want to move, e.g. 1000w.

Maybe for such a thing you shouldn't use vi (but I don't want to start a religious war here).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.