mappings.vim 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. " g Leader key
  2. let mapleader=" "
  3. " let localleader=" "
  4. nnoremap <Space> <Nop>
  5. " Better indenting
  6. vnoremap < <gv
  7. vnoremap > >gv
  8. if exists('g:vscode')
  9. " Simulate same TAB behavior in VSCode
  10. nmap <Tab> :Tabnext<CR>
  11. nmap <S-Tab> :Tabprev<CR>
  12. else
  13. " Better nav for omnicomplete
  14. inoremap <expr> <c-j> ("\<C-n>")
  15. inoremap <expr> <c-k> ("\<C-p>")
  16. " I hate escape more than anything else
  17. inoremap jk <Esc>
  18. inoremap kj <Esc>
  19. " Easy CAPS
  20. " inoremap <c-u> <ESC>viwUi
  21. " nnoremap <c-u> viwU<Esc>
  22. " TAB in general mode will move to text buffer
  23. nnoremap <silent> <TAB> :bnext<CR>
  24. " SHIFT-TAB will go back
  25. nnoremap <silent> <S-TAB> :bprevious<CR>
  26. " Alternate way to save
  27. nnoremap <silent> <C-s> :w<CR>
  28. " Alternate way to quit
  29. nnoremap <silent> <C-Q> :wq!<CR>
  30. " Use control-c instead of escape
  31. nnoremap <silent> <C-c> <Esc>
  32. " <TAB>: completion.
  33. inoremap <silent> <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  34. " Better window navigation
  35. nnoremap <C-h> <C-w>h
  36. nnoremap <C-j> <C-w>j
  37. nnoremap <C-k> <C-w>k
  38. nnoremap <C-l> <C-w>l
  39. " Use alt + hjkl to resize windows
  40. nnoremap <silent> <M-j> :resize -2<CR>
  41. nnoremap <silent> <M-k> :resize +2<CR>
  42. nnoremap <silent> <M-h> :vertical resize -2<CR>
  43. nnoremap <silent> <M-l> :vertical resize +2<CR>
  44. endif