1
0

.vimrc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 'Shougo/unite.vim'
  10. Plug 'Shougo/vimproc.vim', {'do' : 'make'}
  11. Plug 'EinfachToll/DidYouMean'
  12. Plug 'vim-scripts/dbext.vim', {'for': 'sql'}
  13. Plug 'cespare/vim-toml'
  14. if executable('lein')
  15. Plug 'guns/vim-sexp'
  16. Plug 'tpope/vim-sexp-mappings-for-regular-people'
  17. Plug 'tpope/vim-fireplace', {'for': 'clojure'}
  18. endif
  19. if executable('sbt')
  20. Plug 'derekwyatt/vim-scala'
  21. endif
  22. if executable('kotlin')
  23. Plug 'udalov/kotlin-vim'
  24. endif
  25. if executable('ansible')
  26. Plug 'pearofducks/ansible-vim'
  27. endif
  28. if executable('rustc')
  29. Plug 'rust-lang/rust.vim'
  30. endif
  31. if executable('npm')
  32. Plug 'pangloss/vim-javascript'
  33. Plug 'mxw/vim-jsx'
  34. endif
  35. if executable('qml')
  36. Plug 'peterhoeg/vim-qml'
  37. endif
  38. Plug 'trusktr/seti.vim'
  39. call plug#end()
  40. " ----- plugin settings ------
  41. let g:signify_vcs_list = [ 'git' ]
  42. let g:jsx_ext_required = 0
  43. let g:unite_enable_auto_select = 0
  44. " use ag if present
  45. if executable('ag')
  46. let g:unite_source_grep_command = 'ag'
  47. let g:unite_source_grep_default_opts = '-i --vimgrep --hidden'
  48. let g:unite_source_grep_recursive_opt = ''
  49. endif
  50. autocmd FileType unite call s:unite_settings()
  51. function! s:unite_settings()
  52. " Enable navigation with control-j and control-k in insert mode
  53. imap <buffer> <C-j> <Plug>(unite_select_next_line)
  54. imap <buffer> <C-k> <Plug>(unite_select_previous_line)
  55. inoremap <silent><buffer><expr> <C-s> unite#do_action('split')
  56. inoremap <silent><buffer><expr> <C-v> unite#do_action('vsplit')
  57. nnoremap <silent><buffer><expr> s unite#do_action('split')
  58. nnoremap <silent><buffer><expr> v unite#do_action('vsplit')
  59. endfunction
  60. call unite#custom#profile('default', 'context', {
  61. \ 'ignorecase': 1,
  62. \ 'prompt': '> ',
  63. \ 'direction': 'botright',
  64. \ })
  65. " ------ settings ------
  66. " change terminal title
  67. set title
  68. " xdg-ish settings
  69. set undodir=~/.cache/vim/undo,.
  70. set backupdir=~/.cache/vim/backup,.
  71. set directory=~/.cache/vim/swap,.
  72. " default indentation
  73. set shiftwidth=2
  74. set tabstop=4
  75. set expandtab
  76. " permanent undo history
  77. set undofile
  78. " allow switching buffers
  79. set hidden
  80. " always scroll
  81. set scrolloff=99
  82. " show line numbers
  83. set number
  84. set relativenumber
  85. " set wordwrap indent
  86. set nowrap
  87. set linebreak
  88. if exists("&breakindent")
  89. set breakindent
  90. set breakindentopt=shift:2,sbr
  91. endif
  92. " show whitespace
  93. set list
  94. " make a new copy of the file for backup
  95. " setting to no or auto messes with filewatchers
  96. set backupcopy=yes
  97. " ------ key bindings ------
  98. " ; as :
  99. nnoremap ; :
  100. vnoremap ; :
  101. " allow <ESC> via jj in insert mode
  102. inoremap jj <ESC>
  103. " fix j/k with wraps
  104. nnoremap j gj
  105. nnoremap k gk
  106. vnoremap j gj
  107. vnoremap k gk
  108. " opening unite
  109. nnoremap <C-P> :Unite -buffer-name=files -start-insert file_rec/async<cr>
  110. nnoremap <C-O> :Unite -buffer-name=buffers -start-insert buffer<cr>
  111. imap <C-W> <ESC><C-W>
  112. nnoremap <C-T>h :tabprev<cr>
  113. nnoremap <C-T>l :tabnext<cr>
  114. " grepper
  115. nnoremap <Leader>g :Unite grep:.<CR>
  116. " ------ nvim specific ------
  117. if has('nvim')
  118. let g:airline_theme_patch_func = 'AirlineThemePatch'
  119. function! AirlineThemePatch(palette)
  120. let a:palette.terminal = copy(a:palette.insert)
  121. endfunction
  122. let g:terminal_scrollback_buffer_size = 10000
  123. tnoremap <C-j><C-j> <C-\><C-N>
  124. tmap <C-T> <C-\><C-N><C-T>
  125. tmap <C-W> <C-\><C-N><C-W>
  126. tmap <C-P> <C-\><C-N><C-P>
  127. tmap <C-O> <C-\><C-N><C-O>
  128. tnoremap <C-V><C-V><C-V> <C-V><C-V>
  129. tnoremap <C-V><C-V> <C-V>
  130. tnoremap <C-V> <C-\><C-N>"+pi
  131. autocmd BufWinEnter,WinEnter term://* startinsert
  132. endif
  133. augroup formatting
  134. au!
  135. " strip trailing whitespace
  136. autocmd BufWritePre * :%s/\s\+$//e
  137. augroup end
  138. colorscheme seti
  139. if filereadable(expand('~/.vimrc.local'))
  140. source ~/.vimrc.local
  141. endif