Super User is a question and answer site for computer enthusiasts and power users. 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

How can I navigate by line breaks rather than by hard breaks when wrap is turned on, so that when I go down a line I actually go down the line I see rather than the source line in the file? This would be really useful when editing really long lines, such as what come out when I am editing TeX files.

share|improve this question
    
up vote 5 down vote accepted

You can change the default behaviour of j and k adding the following lines to your .vimrc file:

nmap <silent> j gj
nmap <silent> k gk

See also vim tip 308

share|improve this answer

gj and gk move down and up by ‘display lines’ instead of ‘logical lines’.

share|improve this answer

You must log in to answer this question.

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