0

I have a text line (let's call it LINE) wrapped into some fifteen lines on the terminal screen (let's call these lines). Using only the keyboard I need to move up and down lines to edit. Keys j, k, up-arrow and down-arrow move to the neighbouring LINES (possibly some fifteen lines away!) which is not what I want.

5

You can move up and down between the "display lines" of a wrapped line with the gj and gk normal mode commands.

If you find this unintuitive, a fairly common mapping is to swap these with the regular j and k commands:

nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
| improve this answer | |
  • This is exactly what I wanted, thank you Rich. – elmclose Aug 8 at 7:02

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