1
0

.vimrc 2.4 KB

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