I have mapped my arrows keys to move in a visual-line mode, leaving the hjkl
keys for normal, logic line movement:
" Visual movement with the arrows and End-Home
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
inoremap <Home> <C-o>g<Home>
inoremap <End> <C-o>g<End>
This works, but for a minor problem. I have a bit of code in my status line to change color between input mode and normal mode, like this:
if version >= 700
highlight statusLine cterm=bold ctermfg=black ctermbg=red
au InsertLeave * highlight StatusLine cterm=bold ctermfg=black ctermbg=red gui=bold guifg=black guibg=red
au InsertEnter * highlight StatusLine cterm=bold ctermfg=black ctermbg=green gui=bold guifg=black guibg=green
endif
...and I noticed now (on a machine slower than the one I have at home) that every time I press one of the arrows, the temporary mode switch of <ctrl>o
(at least, I think) make the status line flash rapidly red then green again.
It is possible to redefine the keys to avoid the temporary jump to normal mode?