How to navigate 'logical' lines individually in vim?

8

1

I know that there is a setting for this in vim, I just can't find it now...

Basically, I like set wrap. I like it alot. I'm less fond of it skipping down to each actual line, rather than the more intuitive next displayed line. For instance, say I have the following file:

1 Some really, really, really long line that I really possibly should have
  but I do have it, so I'm stuck with it, and if my cursor is ->| here
  and then I press the down button, much to my dismay,
2 The cursor ends up here! ->|

Matthew Scharley

Posted 2009-09-17T07:17:13.050

Reputation: 4 083

Answers

17

You can type gj to move down one screen line, as opposed to one logical line with j.

It may also be possible to map gj to j. Here's an article you may find useful for that:
http://vim.wikia.com/wiki/Moving_by_screen_lines_instead_of_file_lines

nnyby

Posted 2009-09-17T07:17:13.050

Reputation: 959