.vimrc 2.6 KB

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