Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between nnoremap and inoremap

Tags:

vim

I have the following lines in my .vimrc.

 " Arrows are unvimlike 

 nnoremap <up> <nop>
 nnoremap <down> <nop>
 nnoremap <left> <nop>
 nnoremap <right> <nop>
 inoremap <up> <nop>
 inoremap <down> <nop>
 inoremap <left> <nop>
 inoremap <right> <nop>

I understand that the arrow keys are made no operations to force the use of j,k,h,l.But why is there two sets of what seems like same commands.Or in other words what is the difference between nnoremap and inoremap and why both of them are used.

like image 815
liv2hak Avatar asked Apr 03 '14 21:04

liv2hak


1 Answers

You are making sure the arrow keys are nop for both insert and normal mode

From: the Vim Wikia page:

n  Normal mode map. Defined using ':nmap' or ':nnoremap'.
i  Insert mode map. Defined using ':imap' or ':inoremap'.
like image 130
brokenfoot Avatar answered Oct 14 '22 02:10

brokenfoot