.vimrc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. " xdg-ish settings
  31. set undodir=~/.cache/vim/undo,.
  32. set backupdir=~/.cache/vim/backup,.
  33. set directory=~/.cache/vim/swap,.
  34. " default indentation
  35. set shiftwidth=2
  36. set tabstop=4
  37. set expandtab
  38. " permanent undo history
  39. set undofile
  40. " allow switching buffers
  41. set hidden
  42. " always scroll
  43. set scrolloff=99
  44. " show line numbers
  45. set number
  46. set relativenumber
  47. " set wordwrap indent
  48. set nowrap
  49. set linebreak
  50. if exists("&breakindent")
  51. set breakindent
  52. set breakindentopt=shift:2,sbr
  53. endif
  54. " show whitespace
  55. set list
  56. " make a new copy of the file for backup
  57. " setting to no or auto messes with filewatchers
  58. set backupcopy=yes
  59. " ------ key bindings ------
  60. " ; as :
  61. nnoremap ; :
  62. vnoremap ; :
  63. " allow <ESC> via jj in insert mode
  64. inoremap jj <ESC>
  65. " fix j/k with wraps
  66. nnoremap j gj
  67. nnoremap k gk
  68. vnoremap j gj
  69. vnoremap k gk
  70. " opening unite
  71. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec<cr>
  72. nnoremap <C-O> :Unite -no-split -buffer-name=buffers -start-insert buffer<cr>
  73. " ------ nvim specific ------
  74. if has('nvim')
  75. tnoremap jj <C-\><C-N>
  76. tnoremap <C-W> <C-\><C-N><C-W>
  77. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec/neovim<cr>
  78. endif
  79. augroup formatting
  80. au!
  81. " strip trailing whitespace
  82. autocmd BufWritePre * :%s/\s\+$//e
  83. augroup end
  84. colorscheme seti