.vimrc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. call plug#begin('~/.vim/plugged')
  2. Plug 'tpope/vim-sensible'
  3. Plug 'tpope/vim-sleuth'
  4. Plug 'tpope/vim-fugitive'
  5. Plug 'bling/vim-airline'
  6. Plug 'mhinz/vim-signify'
  7. Plug 'Shougo/unite.vim'
  8. if executable('lein')
  9. Plug 'guns/vim-sexp'
  10. Plug 'tpope/vim-sexp-mappings-for-regular-people'
  11. Plug 'tpope/vim-fireplace', {'for': 'clojure'}
  12. endif
  13. Plug 'trusktr/seti.vim'
  14. call plug#end()
  15. " ----- plugin settings ------
  16. let g:signify_vcs_list = [ 'git' ]
  17. call unite#filters#matcher_default#use(['matcher_fuzzy'])
  18. " use ag if present
  19. if executable('ag')
  20. " we run a wrapper around ag so it respects agignore
  21. let g:unite_source_rec_async_command = ['sh', expand('~/.vim/ag-unite')]
  22. endif
  23. autocmd FileType unite call s:unite_settings()
  24. function! s:unite_settings()
  25. " Enable navigation with control-j and control-k in insert mode
  26. imap <buffer> <C-j> <Plug>(unite_select_next_line)
  27. imap <buffer> <C-k> <Plug>(unite_select_previous_line)
  28. endfunction
  29. " ------ settings ------
  30. " default indentation
  31. set shiftwidth=2
  32. set tabstop=4
  33. set expandtab
  34. " permanent undo history
  35. set undofile
  36. set undodir=~/.vim/undo
  37. " allow switching buffers
  38. set hidden
  39. " always scroll
  40. set scrolloff=99
  41. " show line numbers
  42. set number
  43. set relativenumber
  44. " set wordwrap indent
  45. set nowrap
  46. set linebreak
  47. if exists("&breakindent")
  48. set breakindent
  49. set breakindentopt=shift:2,sbr
  50. endif
  51. " show whitespace
  52. set list
  53. " make a new copy of the file for backup
  54. " setting to no or auto messes with filewatchers
  55. set backupcopy=yes
  56. " ------ key bindings ------
  57. " ; as :
  58. nnoremap ; :
  59. vnoremap ; :
  60. " allow <ESC> via jj in insert mode
  61. inoremap jj <ESC>
  62. " fix j/k with wraps
  63. nnoremap j gj
  64. nnoremap k gk
  65. vnoremap j gj
  66. vnoremap k gk
  67. " opening unite
  68. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec<cr>
  69. nnoremap <C-O> :Unite -no-split -buffer-name=buffers -start-insert buffer<cr>
  70. " ------ nvim specific ------
  71. if has('nvim')
  72. tnoremap jj <C-\><C-N>
  73. tnoremap <C-W> <C-\><C-N><C-W>
  74. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec/neovim<cr>
  75. endif
  76. augroup formatting
  77. au!
  78. " strip trailing whitespace
  79. autocmd BufWritePre * :%s/\s\+$//e
  80. augroup end
  81. colorscheme seti