10

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?

1 Answer 1

15

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

gj
gk
g$
g0
g^

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

:map j gj

j moves by screen lines now.

1
  • +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, 2011 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .