vimrc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. " ------ key bindings ------
  38. " ; as :
  39. nnoremap ; :
  40. vnoremap ; :
  41. " allow <ESC> via jj in insert mode
  42. inoremap jj <ESC>
  43. " tab switching
  44. nnoremap <C-T>h :tabprev<cr>
  45. nnoremap <C-T>l :tabnext<cr>
  46. " fix j/k with wraps
  47. nnoremap j gj
  48. nnoremap k gk
  49. vnoremap j gj
  50. vnoremap k gk
  51. " cursor display
  52. nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
  53. " git
  54. nnoremap <Leader>gs :Git<CR>
  55. nnoremap <Leader>gb :Merginal<CR>
  56. " undo tree
  57. nnoremap <Leader>ut :UndotreeToggle<CR>
  58. " vimrc
  59. nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
  60. nnoremap <Leader>vs :source $MYVIMRC<CR>
  61. " ------ nvim specific ------
  62. if has('nvim')
  63. set inccommand=split
  64. tnoremap <C-[><C-[> <C-\><C-N>
  65. autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
  66. autocmd TermOpen * startinsert
  67. autocmd FileType fzf tnoremap <buffer> jj <ESC>
  68. autocmd BufWinEnter,WinEnter term://* startinsert
  69. autocmd BufLeave term://* stopinsert
  70. " fix flickering when clearing terminal
  71. autocmd TermEnter * setlocal scrolloff=0
  72. autocmd TermLeave * setlocal scrolloff=99
  73. nnoremap <Leader>tv :vsp term://$SHELL<CR>
  74. nnoremap <Leader>to :term<CR>
  75. endif
  76. augroup formatting
  77. au!
  78. " strip trailing whitespace
  79. autocmd BufWritePre * :%s/\s\+$//e
  80. autocmd FileType markdown :set tw=80
  81. augroup end
  82. if has('termguicolors')
  83. set termguicolors
  84. endif
  85. let g:sonokai_transparent_background=1
  86. colorscheme sonokai
  87. highlight link MiniIndentscopeSymbol Whitespace
  88. let s:configuration = sonokai#get_configuration()
  89. let s:palette = sonokai#get_palette(s:configuration.style)
  90. call sonokai#highlight('MiniStatuslineModeNormal', s:palette.black, s:palette.blue)
  91. call sonokai#highlight('MiniStatuslineModeCommand', s:palette.black, s:palette.yellow)
  92. call sonokai#highlight('MiniStatuslineModeInsert', s:palette.black, s:palette.green)
  93. call sonokai#highlight('MiniStatuslineModeVisual', s:palette.black, s:palette.orange)
  94. call sonokai#highlight('MiniStatuslineModeReplace', s:palette.black, s:palette.red)
  95. call sonokai#highlight('MiniStatuslineModeOther', s:palette.black, s:palette.green)
  96. unlet! g:terminal_color_0
  97. unlet! g:terminal_color_1
  98. unlet! g:terminal_color_2
  99. unlet! g:terminal_color_3
  100. unlet! g:terminal_color_4
  101. unlet! g:terminal_color_5
  102. unlet! g:terminal_color_6
  103. unlet! g:terminal_color_7
  104. unlet! g:terminal_color_8
  105. unlet! g:terminal_color_9
  106. unlet! g:terminal_color_10
  107. unlet! g:terminal_color_11
  108. unlet! g:terminal_color_12
  109. unlet! g:terminal_color_13
  110. unlet! g:terminal_color_14
  111. unlet! g:terminal_color_15