Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 4 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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.