.vimrc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. call plug#begin('~/.vim/plugged')
  2. Plug 'tpope/vim-sensible'
  3. Plug 'tpope/vim-sleuth'
  4. Plug 'tpope/vim-fugitive'
  5. Plug 'tpope/vim-surround'
  6. Plug 'bling/vim-airline'
  7. Plug 'mhinz/vim-signify'
  8. Plug 'sjl/gundo.vim'
  9. Plug 'ctrlpvim/ctrlp.vim'
  10. if executable('lein')
  11. Plug 'guns/vim-sexp'
  12. Plug 'tpope/vim-sexp-mappings-for-regular-people'
  13. Plug 'tpope/vim-fireplace', {'for': 'clojure'}
  14. endif
  15. if executable('sbt')
  16. Plug 'derekwyatt/vim-scala'
  17. endif
  18. Plug 'trusktr/seti.vim'
  19. call plug#end()
  20. " ----- plugin settings ------
  21. let g:signify_vcs_list = [ 'git' ]
  22. if executable('ag')
  23. " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  24. " we cd first into the dir so ag will use .agignore correctly
  25. let g:ctrlp_user_command = 'cd %s && ag --nocolor --hidden -g ""'
  26. endif
  27. " ------ settings ------
  28. " xdg-ish settings
  29. set undodir=~/.cache/vim/undo,.
  30. set backupdir=~/.cache/vim/backup,.
  31. set directory=~/.cache/vim/swap,.
  32. " default indentation
  33. set shiftwidth=2
  34. set tabstop=4
  35. set expandtab
  36. " permanent undo history
  37. set undofile
  38. " allow switching buffers
  39. set hidden
  40. " always scroll
  41. set scrolloff=99
  42. " show line numbers
  43. set number
  44. set relativenumber
  45. " set wordwrap indent
  46. set nowrap
  47. set linebreak
  48. if exists("&breakindent")
  49. set breakindent
  50. set breakindentopt=shift:2,sbr
  51. endif
  52. " show whitespace
  53. set list
  54. " make a new copy of the file for backup
  55. " setting to no or auto messes with filewatchers
  56. set backupcopy=yes
  57. " ------ key bindings ------
  58. " ; as :
  59. nnoremap ; :
  60. vnoremap ; :
  61. " allow <ESC> via jj in insert mode
  62. inoremap jj <ESC>
  63. " fix j/k with wraps
  64. nnoremap j gj
  65. nnoremap k gk
  66. vnoremap j gj
  67. vnoremap k gk
  68. " opening ctrlp
  69. nnoremap <C-O> :CtrlPBuffer<cr>
  70. nnoremap <C-T>h :tabprev<cr>
  71. nnoremap <C-T>l :tabnext<cr>
  72. " ------ nvim specific ------
  73. if has('nvim')
  74. let g:airline#themes#dark#palette.terminal = copy(g:airline#themes#dark#palette.insert)
  75. tnoremap <C-j><C-j> <C-\><C-N>
  76. tmap <C-T> <C-\><C-N><C-T>
  77. tmap <C-W> <C-\><C-N><C-W>
  78. tmap <C-P> <C-\><C-N><C-P>
  79. tmap <C-O> <C-\><C-N><C-O>
  80. autocmd BufWinEnter,WinEnter term://* startinsert
  81. endif
  82. augroup formatting
  83. au!
  84. " strip trailing whitespace
  85. autocmd BufWritePre * :%s/\s\+$//e
  86. augroup end
  87. colorscheme seti
  88. if filereadable(expand('~/.vimrc.local'))
  89. source ~/.vimrc.local
  90. endif