1
0

vimrc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. " ------ settings ------
  2. " change terminal title
  3. set title
  4. " xdg-ish settings
  5. set undodir=~/.cache/vim/undo,.
  6. set backupdir=~/.cache/vim/backup,.
  7. set directory=~/.cache/vim/swap//,.
  8. " default indentation
  9. set shiftwidth=2
  10. set tabstop=4
  11. set expandtab
  12. " permanent undo history
  13. set undofile
  14. " allow switching buffers
  15. set hidden
  16. " always scroll
  17. set scrolloff=99
  18. " show line numbers
  19. set number
  20. set relativenumber
  21. " show gutter
  22. set signcolumn=yes
  23. " set wordwrap indent
  24. set nowrap
  25. set linebreak
  26. if exists("&breakindent")
  27. set breakindent
  28. set breakindentopt=shift:2,sbr
  29. endif
  30. " show whitespace
  31. set list
  32. " make a new copy of the file for backup
  33. " setting to no or auto messes with filewatchers
  34. set backupcopy=yes
  35. " disable modelines
  36. set nomodeline
  37. " show preview of lines when using :s
  38. set inccommand=split
  39. " ------ key bindings ------
  40. " ; as :
  41. nnoremap ; :
  42. vnoremap ; :
  43. " allow <ESC> via jj in insert mode
  44. inoremap jj <ESC>
  45. " tab switching
  46. nnoremap <C-T>h :tabprev<cr>
  47. nnoremap <C-T>l :tabnext<cr>
  48. " fix j/k with wraps
  49. nnoremap j gj
  50. nnoremap k gk
  51. vnoremap j gj
  52. vnoremap k gk
  53. " cursor display
  54. nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
  55. " git
  56. nnoremap <Leader>gs :Git<CR>
  57. nnoremap <Leader>gb :Merginal<CR>
  58. " undo tree
  59. nnoremap <Leader>ut :UndotreeToggle<CR>
  60. " use <ESC><ESC> to leave terminal mode
  61. tnoremap <C-[><C-[> <C-\><C-N>
  62. " opening terminals
  63. nnoremap <Leader>tv :vsp term://$SHELL<CR>
  64. nnoremap <Leader>to :term<CR>
  65. " default terminal settings
  66. autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
  67. " automatically enter,leave terminal mode
  68. autocmd TermOpen * startinsert
  69. autocmd BufWinEnter,WinEnter term://* startinsert
  70. autocmd BufLeave term://* stopinsert
  71. " strip trailing whitespace
  72. autocmd BufWritePre * %s/\s\+$//e
  73. " filetype specific options
  74. autocmd FileType markdown set tw=80
  75. " ------ theme ------
  76. " use full color if available
  77. if has('termguicolors')
  78. set termguicolors
  79. endif
  80. let g:sonokai_transparent_background=1
  81. colorscheme sonokai
  82. highlight link MiniIndentscopeSymbol Whitespace
  83. let s:configuration = sonokai#get_configuration()
  84. let s:palette = sonokai#get_palette(s:configuration.style)
  85. call sonokai#highlight('MiniStatuslineModeNormal', s:palette.black, s:palette.blue)
  86. call sonokai#highlight('MiniStatuslineModeCommand', s:palette.black, s:palette.yellow)
  87. call sonokai#highlight('MiniStatuslineModeInsert', s:palette.black, s:palette.green)
  88. call sonokai#highlight('MiniStatuslineModeVisual', s:palette.black, s:palette.orange)
  89. call sonokai#highlight('MiniStatuslineModeReplace', s:palette.black, s:palette.red)
  90. call sonokai#highlight('MiniStatuslineModeOther', s:palette.black, s:palette.green)
  91. " use default terminal colors
  92. unlet! g:terminal_color_0
  93. unlet! g:terminal_color_1
  94. unlet! g:terminal_color_2
  95. unlet! g:terminal_color_3
  96. unlet! g:terminal_color_4
  97. unlet! g:terminal_color_5
  98. unlet! g:terminal_color_6
  99. unlet! g:terminal_color_7
  100. unlet! g:terminal_color_8
  101. unlet! g:terminal_color_9
  102. unlet! g:terminal_color_10
  103. unlet! g:terminal_color_11
  104. unlet! g:terminal_color_12
  105. unlet! g:terminal_color_13
  106. unlet! g:terminal_color_14
  107. unlet! g:terminal_color_15