Last Updated: February 25, 2016
·
380
· xaph

Moving with h,j,k,l when in insert mode

I'm a big fan of vim and started to use h,j,k,l to navigate on code instead of arrows. Not moving your hand from home zone to arrows is very healthy and I was upset when in insert mode. Insert mode requires arrows to navigate and it feels so wrong to escape and insert again if I want to edit upper line.

After some investigation I added these configs to my vimrc:

imap <C-h> <C-o>h
imap <C-j> <C-o>j
imap <C-k> <C-o>k
imap <C-l> <C-o>l

Now, I can use ctrl + h, ctrl+j, ctrl+k, ctrl+l to navigate in insert mode.

2 Responses
Add your response

this is very bad smell, to move around in INS mode. Whole concept of vim to do all motions in normal mode, and think about text as an objects: char, word, sentence, paragraph, block..

over 1 year ago ·

I agree with you but I really hate swapping modes when I write something wrong.

over 1 year ago ·