开发者

VIM - Move through wrapped lines (in insert mode)

I'm not a fan of 80(or 72) characters pr. line followed by a line-break even if your VIM inserts the line-break itself - you'll easily run into inconsistency problems when editing that line of text afterwards. Otherwise I have nothing against the editor, but somehow editing text as I do in a GUI editor makes me sleep better at night.

So, I开发者_运维技巧 discovered that the reason for the line breaks was primarily due to inability to move through softly wrapped lines, and hence I found this article: http://vim.wikia.com/wiki/Move_through_wrapped_lines which works, but I'm looking for a solution that would work in insert-mode as well as edit-mode.

P.S. I'm probably a newbie at VIM :)


Why would you need to move through wrapped lines in insert mode? You'd better move through such lines in command mode with gj and gk and when you need to edit something, press i, edit and go out of insert mode. The less time you'll be spending in insert mode, the better.


imap <Down> <C-o>gj 

and

imap <Up> <C-o>gk

works for me.

My configuration is as follows:

vmap <silent> <Right> l
vmap <silent> <Left> h
vmap <silent> <Up> gk
vmap <silent> <Down> gj
nmap <silent> <Right> l
nmap <silent> <Left> h
nmap <silent> <Up> gk
nmap <silent> <Down> gj
imap <silent> <Up> <C-o>gk
imap <silent> <Down> <C-o>gj

My complete configuration is here:

https://github.com/Waxolunist/vimconf

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜