1
0

.vimrc 2.8 KB

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