Reputation: 19628
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'.
Upvotes: 0
Views: 300
Reputation: 17333
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 visuallyg8j
: go down 8 visual linesYou 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.
Upvotes: 5
Reputation: 5808
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).
Upvotes: 3