mappings.vim 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. " Basic Key Mappings
  2. imap <C-h> <C-w>h
  3. imap <C-j> <C-w>j
  4. imap <C-k> <C-w>k
  5. imap <C-l> <C-w>l
  6. " g Leader key
  7. let mapleader=" "
  8. " let localleader=" "
  9. nnoremap <Space> <Nop>
  10. " Better indenting
  11. vnoremap < <gv
  12. vnoremap > >gv
  13. " I hate escape more than anything else
  14. inoremap jk <Esc>
  15. inoremap kj <Esc>
  16. " Easy CAPS
  17. " inoremap <c-u> <ESC>viwUi
  18. " nnoremap <c-u> viwU<Esc>
  19. " TAB in general mode will move to text buffer
  20. nnoremap <silent> <TAB> :bnext<CR>
  21. " SHIFT-TAB will go back
  22. nnoremap <silent> <S-TAB> :bprevious<CR>
  23. " Move selected line / block of text in visual mode
  24. " shift + k to move up
  25. " shift + j to move down
  26. xnoremap K :move '<-2<CR>gv-gv
  27. xnoremap J :move '>+1<CR>gv-gv
  28. " Alternate way to save
  29. nnoremap <silent> <C-s> :w<CR>
  30. " Alternate way to quit
  31. nnoremap <silent> <C-Q> :wq!<CR>
  32. " Use control-c instead of escape
  33. nnoremap <silent> <C-c> <Esc>
  34. " <TAB>: completion.
  35. inoremap <silent> <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  36. " Better window navigation
  37. nnoremap <C-h> <C-w>h
  38. nnoremap <C-j> <C-w>j
  39. nnoremap <C-k> <C-w>k
  40. nnoremap <C-l> <C-w>l
  41. " Terminal window navigation
  42. tnoremap <C-h> <C-\><C-N><C-w>h
  43. tnoremap <C-j> <C-\><C-N><C-w>j
  44. tnoremap <C-k> <C-\><C-N><C-w>k
  45. tnoremap <C-l> <C-\><C-N><C-w>l
  46. inoremap <C-h> <C-\><C-N><C-w>h
  47. inoremap <C-j> <C-\><C-N><C-w>j
  48. inoremap <C-k> <C-\><C-N><C-w>k
  49. inoremap <C-l> <C-\><C-N><C-w>l
  50. tnoremap <Esc> <C-\><C-n>
  51. " Use alt + hjkl to resize windows
  52. nnoremap <silent> <M-j> :resize -2<CR>
  53. nnoremap <silent> <M-k> :resize +2<CR>
  54. nnoremap <silent> <M-h> :vertical resize -2<CR>
  55. nnoremap <silent> <M-l> :vertical resize +2<CR>
  56. " Better nav for omnicomplete
  57. inoremap <expr> <c-j> ("\<C-n>")
  58. inoremap <expr> <c-k> ("\<C-p>")