Vim Key Mappings

Custom key mappings and leader keys in Vim

Mapping Modes

nnoremap # normal mode (non-recursive)
inoremap # insert mode
vnoremap # visual mode
xnoremap # visual block mode
cnoremap # command mode
tnoremap # terminal mode

Leader Key

# Set leader key
let mapleader = comma # comma as leader
let mapleader = space # space as leader

# Use leader in mappings
nnoremap leader w :w CR # save file
nnoremap leader q :q CR # quit

Common Mappings

# Navigation
nnoremap C-h C-w h # move to left split
nnoremap C-l C-w l # move to right split

# Editing
inoremap jk Esc # escape with jk
nnoremap Y y$ # yank to end of line

Plugin Mappings

# NERDTree
nnoremap leader n :NERDTreeToggle CR

# fzf
nnoremap C-p :Files CR
nnoremap leader b :Buffers CR

# Git fugitive
nnoremap leader gs :Git status CR

Special Keys

CR # Enter/Return
Esc # Escape
C-x # Ctrl+x
S-x # Shift+x
A-x # Alt+x
leader # Leader key
Space # Spacebar