Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigate between soft lines in Vim

Tags:

vim

word-wrap

I have the following one-line text input that's broken into several soft line wraps. Vim screenshot with multiple soft line wraps

When I press j, I'd go straight to the next hard line, line 2. How do I navigate among soft line wraps?

like image 238
Kit Avatar asked Nov 28 '11 07:11

Kit


2 Answers

Use gj to go down and gk to go up by visual lines instead of hard lines.

like image 111
Idan Arye Avatar answered Oct 05 '22 23:10

Idan Arye


put that to your .vimrc:

map <silent> <Up> gk
imap <silent> <Up> <C-o>gk
map <silent> <Down> gj
imap <silent> <Down> <C-o>gj
map <silent> <home> g<home>
imap <silent> <home> <C-o>g<home>
map <silent> <End> g<End>
imap <silent> <End> <C-o>g<End>
like image 32
A S Avatar answered Oct 05 '22 22:10

A S