1

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?

3

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.

  • 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 Aug 17 '18 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 Aug 17 '18 at 3:07
  • @pfnuesel Thanks for mentioning that, it's an excellent usage. – Vold Notz Aug 17 '18 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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