# How to have l and h at the boundary of the window shift only one column, when wrap is off?

How can I have h and l move the viewport only by one column when they go beyond the left and right borders when nowrap is active?

• I know you can scroll horizontally by a column at a time with zl and zh but it doesn't move the cursor. Does that work for you? Not sure if you can do it with cursor moving. But a mapping to do so should be doable. nnoremap zl zl<right> – B Layer Oct 14 '20 at 19:10
• @BLayer, at least it allows a kind of workaround. I could map h to do zh followed by h, and similarly for l. I'll try it out while waiting for answers. – Enlico Oct 14 '20 at 19:13
• Exactly what I had in mind. – B Layer Oct 14 '20 at 19:13
• Oooh, maybe 'sidescroll' – B Layer Oct 14 '20 at 19:22

set sidescroll=1

'sidescroll' controls "the minimal number of columns to scroll horizontally". So with a value of 1 h and l will shift the screen one column at a time.
Side note: the commands zh and zl will shift the screen a column at a time but they don't move the cursor. If, for some reason, you couldn't or didn't want to change 'sidescroll' you could do something like nnoremap zh zh<left> to achieve the same effect.