mappings.vim 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. " Better nav for omnicomplete
  2. inoremap <expr> <c-j> ("\<C-n>")
  3. inoremap <expr> <c-k> ("\<C-p>")
  4. " Use alt + hjkl to resize windows
  5. nnoremap <M-j> :resize -2<CR>
  6. nnoremap <M-k> :resize +2<CR>
  7. nnoremap <M-h> :vertical resize -2<CR>
  8. nnoremap <M-l> :vertical resize +2<CR>
  9. " I hate escape more than anything else
  10. inoremap jk <Esc>
  11. inoremap kj <Esc>
  12. " Easy CAPS
  13. inoremap <c-u> <ESC>viwUi
  14. nnoremap <c-u> viwU<Esc>
  15. " TAB in general mode will move to text buffer
  16. nnoremap <TAB> :bnext<CR>
  17. " SHIFT-TAB will go back
  18. nnoremap <S-TAB> :bprevious<CR>
  19. " Alternate way to save
  20. nnoremap <C-s> :w<CR>
  21. " Alternate way to quit
  22. nnoremap <C-Q> :wq!<CR>
  23. " Use control-c instead of escape
  24. nnoremap <C-c> <Esc>
  25. " <TAB>: completion.
  26. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  27. " Better tabbing
  28. vnoremap < <gv
  29. vnoremap > >gv
  30. " Better window navigation
  31. nnoremap <C-h> <C-w>h
  32. nnoremap <C-j> <C-w>j
  33. nnoremap <C-k> <C-w>k
  34. nnoremap <C-l> <C-w>l
  35. nnoremap <Leader>o o<Esc>^Da
  36. nnoremap <Leader>O O<Esc>^Da
  37. nnoremap <F6> :call ToggleMouse()<CR>
  38. function! ToggleMouse()
  39. if &mouse == 'a'
  40. set mouse=
  41. echo "Mouse usage disabled"
  42. else
  43. set mouse=a
  44. echo "Mouse usage enabled"
  45. endif
  46. endfunction