Herr Bischoff


In Defense of Vim Arrow Keys

Inspired by this post I went ahead and edited my init.vim to reflect the following changes:

nmap <silent> <Left> <<
nmap <silent> <Right> >>

nnoremap <silent> <down> :m .+1<CR>==
nnoremap <silent> <up> :m .-2<CR>==
inoremap <silent> <down> <Esc>:m .+1<CR>==gi
inoremap <silent> <up> <Esc>:m .-2<CR>==gi
vnoremap <silent> <down> :m '>+1<CR>gv=gv
vnoremap <silent> <up> :m '<-2<CR>gv=gv

The first block enables the left and right arrow keys to indent lines in normal mode. The second block maps the up and down arrow keys to move a line up or down.

This way, they now behave like text movement controls rather than cursor movement controls. I love it.