maps.vim 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. " Shortcuts
  2. nnoremap <silent> <space>a :ALEInfo<lf>
  3. nnoremap <silent> <space>e :wq<lf>
  4. nnoremap <silent> <space>f :ALEFix<lf>
  5. nnoremap <silent> <space>n :wn<lf>
  6. nnoremap <silent> <space>q :q!<lf>
  7. nnoremap <silent> <space>s :w<lf>
  8. nnoremap <silent> <space>u :UltiSnipsEdit<lf>
  9. nnoremap <silent> <space>v :execute "split ".g:vimdir."/vimrc"<lf>
  10. " Shortcuts for Git
  11. nnoremap <space>gs :Gstatus<lf>
  12. nnoremap <space>ga :Gwrite<lf>
  13. nnoremap <space>gc :Gcommit <bar> startinsert<lf>
  14. nnoremap <space>gp :Gpush<lf>
  15. nnoremap <space>gr :Gread<lf>
  16. nnoremap <space>gl :Gpull<lf>
  17. " Shortcuts for language server
  18. nnoremap <space>lD :LspDeclaration<lf>
  19. nnoremap <space>ld :LspDefinition<lf>
  20. nnoremap <space>le :LspDocumentDiagnostics<lf>
  21. nnoremap <space>lf :LspDocumentFormat<lf>
  22. nnoremap <space>lh :LspHover<lf>
  23. nnoremap <space>li :LspImplementation<lf>
  24. nnoremap <space>lr :LspRename<lf>
  25. " Other maps
  26. if g:mobile
  27. inoremap ˇD Ď
  28. inoremap ˇN Ň
  29. inoremap ˇT Ť
  30. inoremap ˇd ď
  31. inoremap ˇn ň
  32. inoremap ˇt ť
  33. nnoremap : :call TempGdefault()<lf>:
  34. noremap E J
  35. noremap J E
  36. noremap K N
  37. noremap L R
  38. noremap N K
  39. noremap R L
  40. noremap e gj
  41. noremap j e
  42. noremap k n
  43. noremap l r
  44. noremap n gk
  45. noremap r l
  46. xnoremap : :call TempGdefault()<lf>gv:
  47. else
  48. nnoremap , :call TempGdefault()<lf>:
  49. nnoremap : @:
  50. noremap H ^
  51. noremap L $
  52. nnoremap gj j
  53. nnoremap gk k
  54. nnoremap j gj
  55. nnoremap k gk
  56. xnoremap , :call TempGdefault()<lf>gv:
  57. xnoremap <space> <esc>
  58. endif
  59. nnoremap ", vi"<esc>`<hr„`>3lr“
  60. nnoremap "; vi"<esc>`<hr“`>3lr”
  61. nnoremap +i :Import<space>
  62. nnoremap +v :set virtualedit=all<lf>
  63. nnoremap -u "uyy"upVr-
  64. nnoremap -v :set virtualedit=<lf>
  65. nnoremap <cr> o<esc>
  66. nnoremap <space> <nop>
  67. nnoremap =u "uyy"upVr=
  68. nnoremap cp viw<esc>:let @e = expand('<cword>')->PalindromizeEnding()<lf>a<c-r>e<esc>
  69. nnoremap c* "cyiwmc:call RenameHelper()<cr>ciw
  70. nnoremap g<cr> O<esc>
  71. nnoremap <silent> gb :bnext<lf>
  72. nnoremap <silent> gB :bprevious<lf>
  73. nnoremap gm m
  74. nnoremap zh <c-w>h
  75. nnoremap zj <c-w>j
  76. nnoremap zk <c-w>k
  77. nnoremap zl <c-w>l
  78. noremap <c-v> v
  79. noremap <down> <nop>
  80. noremap <left> <nop>
  81. noremap <right> <nop>
  82. noremap <up> <nop>
  83. noremap v <c-v>
  84. xnoremap ", "qdi„“<esc>"qP
  85. xnoremap "; "qdi“”<esc>"qP
  86. xnoremap _ :sort<lf>
  87. function! RenameHelper() abort
  88. augroup RenameHelper
  89. autocmd!
  90. autocmd InsertLeave * execute '%substitute/\<' . @c . '\>/' . @. . '/g | normal! `c' | autocmd! RenameHelper
  91. augroup END
  92. endfunction
  93. function! TempGdefault() abort
  94. set gdefault
  95. let g:temp_gdefault = 1
  96. augroup TempGdefault
  97. autocmd!
  98. autocmd CmdLineEnter * if g:temp_gdefault | let g:temp_gdefault = 0 | else | set nogdefault | autocmd! TempGdefault | endif
  99. augroup END
  100. endfunction