mappings.vim 1.1 KB

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