Horizontal navigation in long lines

Use shift + scrolling keys to move faster through text


Did you try :help scroll-horizontal?

You could use a mapping to scroll, for example, 20 characters to the left or to the right:

map <C-L> 20zl " Scroll 20 characters to the right
map <C-H> 20zh " Scroll 20 characters to the left

Without applying a mapping, you could use zL to move the view a half screenwidth to the right and zH to do it to the left.

Regarding the second part of your question: I don't think that this is possible. You could yank the whole line, paste it into a second (scratch) buffer and scroll there. This would work as long as you're just reading the lines. Problems will arise as soon as you want to change something. But it's quite cumbersome...


adding to other answers also pay attention to ze and zs, meaning: move screen to the left/right of the cursor

below I paste my mnemonic for scrolling also look at the position of h and l (and t and b) on the keyboard to remember where the screen is moving

+-------------------------------+
^                               |
|c-e (keep cursor)              |
|H(igh)             zt (top)    |
|                   ^           |
|           ze      |      zs   |
|M(iddle)  zh/zH <--zz--> zl/zL |
|                   |           |
|                   v           |
|L(ow)              zb (bottom) |
|c-y (keep cursor)              |
v                               |
+-------------------------------+

Tags:

Vim

Navigation