.vimrc 2.5 KB

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