2

I love the keybindings zt zb and zz. They redraw the current window such that your cursor stays at the same place in the document, but it moves on your screen. The cursor will now be at the top, the bottom, or, well, ..., the zenter.

Does the same keybings exist for horizontal movement?

1 Answer 1

5

I think zs and ze may be helpful. Try help: zs help ze.

                                                    zs

zs Scroll the text horizontally to position the cursor at the start (left side) of the screen. This only works when 'wrap' is off. {not in Vi}

                                                    ze

ze Scroll the text horizontally to position the cursor at the end (right side) of the screen. This only works when 'wrap' is off. {not in Vi}

Additionally, these two commands let the cursor still stay at the original place in the text.

2
  • Excellent! Exactly what I was looking for. Thanks! Interestingly, I searched before under :help z, but then looked for the keyword redraw, which can be found for zt, zb and zz, but not for ze and zs. That's
    – pfnuesel
    Commented Aug 17, 2018 at 2:51
  • 1
    Analog to scrolloff (offset for vertical scrolling), there is also an offset for horizontal scrolling. E.g.: :set sidescrolloff=8.
    – pfnuesel
    Commented Aug 17, 2018 at 3:07

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.