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.

link|improve this question

78% accept rate
feedback

2 Answers

up vote 3 down vote accepted

I have the following lines im my .vimrc:

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

that change the default behaviour of j and k.

See also vim tip 308

link|improve this answer
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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