When editing files in vim, it is a small annoyance that when I move lines with j and k, it moves by file lines, rather than screen lines like other editors. With my own files, I can deal with this by automatically wrapping to a certain length in the vim options, but this is no good for files from others. Is there a vim command to either temporarily toggle the treatment of lines to screen lines, or alternate commands for moving that use screen lines?


You can move around the screen lines by using g in front of the commands:


You can also map the original commands to the g commands like this:

:map j gj

j moves by screen lines now.

  • +1 for the map suggestion. Although I personally dont want to do it all the time, I'd like to use it when I want it. – jeffjose Jan 9 '11 at 19:35

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.