Source

dotfiles / vim / cfg / mappings

" Ctrl+(hjkl) moves through windows
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <C-h> <C-w>h

" Quick exit
inoremap jj <Esc>

" Alt+(Up,Down,Left,Right) moves through windows
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>

" Ctrl-S for save (exit insert mode after save)
noremap <silent> <C-S> :update<CR>
vnoremap <silent> <C-S> <C-C>:update<CR>
inoremap <silent> <C-S> <C-O>:update<CR><Esc>

" Django manage.py shortcuts
nmap <leader>mb :!./manage.py 
nmap <leader>ms :!./manage.py runserver<CR>
nmap <leader>mi :!./manage.py schemamigration --initial 
nmap <leader>ma :!./manage.py schemamigration --auto 
nmap <leader>mm :!./manage.py migrate 

" VirtualEnv shortcuts
nmap <leader>va :VirtualEnvActivate 
nmap <leader>vd :VirtualEnvDeactivate<CR>
nmap <leader>vl :VirtualEnvList<CR>

nmap <silent> <C-n> :NERDTreeToggle<CR>

nmap <leader>t :TagbarToggle<CR>

nmap <leader>q :bd<CR>

nmap <C-B> :CtrlPBuffer<CR>