Vim’s default mapping for leader is
most peoples remap it to
which I personally think is not a good choice.Remap it to either CAPSLOCK or SPACE key , and find out which works better for you.For me CAPSLOCK didn’t workout well.
In modal editor like VIM we constantly need to switch modes.Switching to normal mode vim uses esc key which to too far on my keyboard.And ctrl-[ is painful to reach out.So I’ve mapped it to keys available on home row.I might seem an overkill , using 2 keys to do a job that just required 1 key.But trust me you will thank yourself for dropping this mapping into your .vimrc file after few days.
imap fj <esc> imap jf <esc>
03 : (command-mode)
If you are a regular vim user you might have felt that switching to command mode is requires you to hit 2 keystrokes.We can fix it by mapping : ; in normal mode.Hardly many peoples use semi-colon functionality .If I am right most peoples don’t even know what it does.
nnoremap ; :
nnoremap : ;
04 Function Key
We have function keys at our disposal, use your creativity and map it to either a command or combination or even vim functions.Below are a mapping from my vimrc
set pastetoggle=<F2> nnoremap <F3> :noh<CR><CR> nnoremap <F5> :set spell!<CR>
05 Shift+Function key
Yes you read it correct.You have more 12 keys to fiddle with and make your vimrc more awesome.if you are a programmer map function keys to compile and format code ,call linter. If you are using vim to write notes or write anything else map fn keys to help you out.Possibilities are endless.
nnoremap <S-F5> ggvG= "shift <F5> to format code
06 Arrow keys
If you are beginner map arrow keys to do nothing, i.e just disable these keys.So that you force yourself to use vim as it is supposed to be used.
noremap <Up> <NOP> noremap <Down> <NOP> noremap <Left> <NOP> noremap <Right> <NOP>
If you are already in the habit of using hjkl keys to navigate.these mapping are not of much importance to you. Level 2 user can map arrows keys to navigate windows.
map <Up> <C-W>k map <Down> <C-W>j map <Left> <C-W>h map <Right> <C-W>l
Tab key in normal mode is useless.Map tab key to switch tab.Tab to switch tab, hahahahaha. Below is the vimrc snippet that will help you do that.
nmap <tab> gt nmap <s-tab> gT
Its not actually my idea.One guy at reddit has posted comment about it.It is actually very convenient to map CTRL to CAPSLOCK .Thank him for sharing his thought
I have focused only on the things you need to often in any text editor.There are a lots of articles out there which show you mapping to do just about anything.