Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 14 down vote accepted

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.

share|improve this answer
+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 posting your answer, you agree to the privacy policy and terms of service.

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