.vimrc 2.8 KB

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