Vim: Quickly navigate between long wrapped lines

Moving around long lines in Vim with the arrow keys has always driven me nuts. Sometimes it's just a big chunk of text (think legalese) and I just need to get to a column in the middle of the text and it takes forever to get there.

It's unorthodox, but it'll get you there.

To quickly navigate through long lines in normal/command/viewing mode, try pressing "gk" and "gj" to go up/down a visual soft-line and ignore the line wrapping.

If that's the sort of behaviour you're after, you can map it to a key of your choice by editing ~/.vimrc by adding these lines:

" Allow arrow keys to navigate soft lines
map <Up> gk
map <Down> gj

Of course you can substitute <Up> and <Down> with any other key you feel like.


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog