vimrc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. " ----- plugin settings ------
  2. let g:signify_vcs_list = [ 'git' ]
  3. let g:lightline = {
  4. \ 'colorscheme': 'wombat',
  5. \ 'active': {
  6. \ 'left': [ [ 'mode', 'paste' ],
  7. \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
  8. \ },
  9. \ 'component_function': {
  10. \ 'gitbranch': 'fugitive#head'
  11. \ },
  12. \ }
  13. " ------ settings ------
  14. " change terminal title
  15. set title
  16. " xdg-ish settings
  17. set undodir=~/.cache/vim/undo,.
  18. set backupdir=~/.cache/vim/backup,.
  19. set directory=~/.cache/vim/swap//,.
  20. " default indentation
  21. set shiftwidth=2
  22. set tabstop=4
  23. set expandtab
  24. " permanent undo history
  25. set undofile
  26. " allow switching buffers
  27. set hidden
  28. " always scroll
  29. set scrolloff=99
  30. " show line numbers
  31. set number
  32. set relativenumber
  33. " show gutter
  34. set signcolumn=yes
  35. " set wordwrap indent
  36. set nowrap
  37. set linebreak
  38. if exists("&breakindent")
  39. set breakindent
  40. set breakindentopt=shift:2,sbr
  41. endif
  42. " show whitespace
  43. set list
  44. " make a new copy of the file for backup
  45. " setting to no or auto messes with filewatchers
  46. set backupcopy=yes
  47. " disable modelines
  48. set nomodeline
  49. " ------ key bindings ------
  50. " ; as :
  51. nnoremap ; :
  52. vnoremap ; :
  53. " allow <ESC> via jj in insert mode
  54. inoremap jj <ESC>
  55. " tab switching
  56. nnoremap <C-T>h :tabprev<cr>
  57. nnoremap <C-T>l :tabnext<cr>
  58. " fix j/k with wraps
  59. nnoremap j gj
  60. nnoremap k gk
  61. vnoremap j gj
  62. vnoremap k gk
  63. " cursor display
  64. nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
  65. " fzf
  66. nnoremap <C-P> :GitFiles -o -c --exclude-standard<CR>
  67. nnoremap <C-O> :Buffers<CR>
  68. if executable('rg')
  69. nnoremap <Leader>f :Rg<SPACE>
  70. elseif executable('ag')
  71. nnoremap <Leader>f :Ag<SPACE>
  72. endif
  73. " git
  74. nnoremap <Leader>gs :Git status<CR>
  75. nnoremap <Leader>gb :Merginal<CR>
  76. " undo tree
  77. nnoremap <Leader>ut :GundoToggle<CR>
  78. " vimrc
  79. nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
  80. nnoremap <Leader>vs :source $MYVIMRC<CR>
  81. " ------ nvim specific ------
  82. if has('nvim')
  83. set inccommand=split
  84. tnoremap <C-[><C-[> <C-\><C-N>
  85. autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
  86. autocmd TermOpen * startinsert
  87. autocmd FileType fzf tnoremap <buffer> jj <ESC>
  88. autocmd BufWinEnter,WinEnter term://* startinsert
  89. autocmd BufLeave term://* stopinsert
  90. " fix flickering when clearing terminal
  91. autocmd TermEnter * setlocal scrolloff=0
  92. autocmd TermLeave * setlocal scrolloff=99
  93. nnoremap <Leader>tv :vsp term://$SHELL<CR>
  94. nnoremap <Leader>to :term<CR>
  95. endif
  96. augroup formatting
  97. au!
  98. " strip trailing whitespace
  99. autocmd BufWritePre * :%s/\s\+$//e
  100. autocmd FileType markdown :set tw=80
  101. augroup end
  102. colorscheme seti
  103. highlight link FloatBorder NonText