In vim, how do I move down a line as it's displayed in the terminal? [duplicate]
Possible Duplicate:
When navigating through word-wrapped text in VIM, how to make the selector move onto wrapped line sections?
Hi all,
I'm editing some source files with large chunks of text and lines that wrap in my terminal. If I want to move down one "line" as I see it in the terminal, I can't press 'j' as this will jump to the next carriage return. So I end up holding down 'w' until I'm where I want to be. This seems dumb to me.
Is there some way someone knows to achieve what I want? Something akin to 'l80' which would give me what I'm after so long as my terminal is displaying 80 columns, but wouldn't work as soon as the number of columns in the terminal changes. Nor 开发者_如何学运维would it jump the real lines when it hits them.
Thanyou
Use gj and gk to move up and down within a wrapped line.
A lot of people map:
nnoremap j gj
nnoremap k gk
To make this more convenient. It doesn't have any adverse effects.
(If you aren't familiar with customizing Vim, you can just put those two lines in ~/.vimrc
, and restart, and it should behave like you want it to.)
精彩评论