init.vim 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 'tpope/vim-abolish'
  7. Plug 'bling/vim-airline'
  8. Plug 'mhinz/vim-signify'
  9. Plug 'sjl/gundo.vim'
  10. Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' }
  11. Plug 'Shougo/deoplete.nvim'
  12. Plug 'EinfachToll/DidYouMean'
  13. Plug 'diepm/vim-rest-console'
  14. Plug 'idanarye/vim-merginal'
  15. Plug 'vimwiki/vimwiki'
  16. Plug 'vim-scripts/dbext.vim', {'for': 'sql'}
  17. Plug 'cespare/vim-toml'
  18. Plug 'chrisbra/csv.vim'
  19. if executable('lein')
  20. Plug 'guns/vim-sexp'
  21. Plug 'tpope/vim-sexp-mappings-for-regular-people'
  22. Plug 'tpope/vim-fireplace', {'for': 'clojure'}
  23. endif
  24. if executable('sbt')
  25. Plug 'derekwyatt/vim-scala'
  26. endif
  27. if executable('kotlin')
  28. Plug 'udalov/kotlin-vim'
  29. endif
  30. if executable('ansible')
  31. Plug 'pearofducks/ansible-vim'
  32. endif
  33. if executable('rustc')
  34. Plug 'rust-lang/rust.vim'
  35. endif
  36. if executable('npm')
  37. Plug 'pangloss/vim-javascript'
  38. Plug 'mxw/vim-jsx'
  39. endif
  40. if executable('qml')
  41. Plug 'peterhoeg/vim-qml'
  42. endif
  43. Plug 'trusktr/seti.vim'
  44. call plug#end()
  45. " ----- plugin settings ------
  46. let g:deoplete#enable_at_startup = 1
  47. let g:signify_vcs_list = [ 'git' ]
  48. let g:jsx_ext_required = 0
  49. let g:airline_left_sep=''
  50. let g:airline_right_sep=''
  51. let g:vimwiki_list = [{'path': '~/.root/home/wiki'}]
  52. let g:vrc_curl_opts = {
  53. \ '-L': '',
  54. \ '-i': '',
  55. \ '-s': '',
  56. \ '-S': ''
  57. \}
  58. call denite#custom#option('_', 'cursor_wrap', 1)
  59. call denite#custom#option('_', 'prompt', '>')
  60. call denite#custom#option('_', 'updatetime', 16)
  61. call denite#custom#map(
  62. \ 'insert',
  63. \ 'jj',
  64. \ '<denite:quit>',
  65. \ 'noremap'
  66. \)
  67. call denite#custom#map(
  68. \ 'insert',
  69. \ '<C-j>',
  70. \ '<denite:move_to_next_line>',
  71. \ 'noremap'
  72. \)
  73. call denite#custom#map(
  74. \ 'insert',
  75. \ '<C-k>',
  76. \ '<denite:move_to_previous_line>',
  77. \ 'noremap'
  78. \)
  79. call denite#custom#map(
  80. \ 'insert',
  81. \ '<C-s>',
  82. \ '<denite:do_action:split>',
  83. \ 'noremap'
  84. \)
  85. call denite#custom#map(
  86. \ 'insert',
  87. \ '<C-v>',
  88. \ '<denite:do_action:vsplit>',
  89. \ 'noremap'
  90. \)
  91. " use rg or ag if present
  92. if executable('rg')
  93. call denite#custom#var('file_rec', 'command',
  94. \ ['rg', '--files', '--glob', '!.git'])
  95. call denite#custom#var('grep', 'command', ['rg'])
  96. call denite#custom#var('grep', 'default_opts',
  97. \ ['--vimgrep', '--no-heading'])
  98. call denite#custom#var('grep', 'recursive_opts', [])
  99. call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
  100. call denite#custom#var('grep', 'separator', ['--'])
  101. call denite#custom#var('grep', 'final_opts', [])
  102. elseif executable('ag')
  103. call denite#custom#var('file_rec', 'command',
  104. \ ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''])
  105. call denite#custom#var('grep', 'command', ['ag'])
  106. call denite#custom#var('grep', 'default_opts',
  107. \ ['-i', '--vimgrep'])
  108. call denite#custom#var('grep', 'recursive_opts', [])
  109. call denite#custom#var('grep', 'pattern_opt', [])
  110. call denite#custom#var('grep', 'separator', ['--'])
  111. call denite#custom#var('grep', 'final_opts', [])
  112. endif
  113. " ------ settings ------
  114. " change terminal title
  115. set title
  116. " xdg-ish settings
  117. set undodir=~/.cache/vim/undo,.
  118. set backupdir=~/.cache/vim/backup,.
  119. set directory=~/.cache/vim/swap//,.
  120. " default indentation
  121. set shiftwidth=2
  122. set tabstop=4
  123. set expandtab
  124. " permanent undo history
  125. set undofile
  126. " allow switching buffers
  127. set hidden
  128. " always scroll
  129. set scrolloff=99
  130. " show line numbers
  131. set number
  132. set relativenumber
  133. " show gutter
  134. set signcolumn=yes
  135. " set wordwrap indent
  136. set nowrap
  137. set linebreak
  138. if exists("&breakindent")
  139. set breakindent
  140. set breakindentopt=shift:2,sbr
  141. endif
  142. " show whitespace
  143. set list
  144. " make a new copy of the file for backup
  145. " setting to no or auto messes with filewatchers
  146. set backupcopy=yes
  147. " ------ key bindings ------
  148. " ; as :
  149. nnoremap ; :
  150. vnoremap ; :
  151. " allow <ESC> via jj in insert mode
  152. inoremap jj <ESC>
  153. " fix j/k with wraps
  154. nnoremap j gj
  155. nnoremap k gk
  156. vnoremap j gj
  157. vnoremap k gk
  158. " opening unite
  159. nnoremap <C-P> :Denite file_rec<cr>
  160. nnoremap <C-O> :Denite buffer<cr>
  161. imap <C-W> <ESC><C-W>
  162. nnoremap <C-T>h :tabprev<cr>
  163. nnoremap <C-T>l :tabnext<cr>
  164. " grepper
  165. nnoremap <Leader>f :Denite -mode=normal grep:.<CR>
  166. " git
  167. nnoremap <Leader>gs :Gstatus<CR>
  168. nnoremap <Leader>gb :Merginal<CR>
  169. " undo tree
  170. nnoremap <Leader>ut :GundoToggle<CR>
  171. " vimrc
  172. nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
  173. nnoremap <Leader>vs :source $MYVIMRC<CR>
  174. " ------ nvim specific ------
  175. if has('nvim')
  176. set inccommand=split
  177. let g:airline_theme_patch_func = 'AirlineThemePatch'
  178. function! AirlineThemePatch(palette)
  179. let a:palette.terminal = copy(a:palette.insert)
  180. endfunction
  181. let g:terminal_scrollback_buffer_size = 10000
  182. tnoremap <C-j><C-j> <C-\><C-N>
  183. tmap <C-T> <C-\><C-N><C-T>
  184. tmap <C-W> <C-\><C-N><C-W>
  185. tmap <C-P> <C-\><C-N><C-P>
  186. tmap <C-O> <C-\><C-N><C-O>
  187. tnoremap <C-V><C-V><C-V> <C-V><C-V>
  188. tnoremap <C-V><C-V> <C-V>
  189. tnoremap <C-V> <C-\><C-N>"+pi
  190. autocmd BufWinEnter,WinEnter term://* startinsert
  191. autocmd BufLeave term://* stopinsert
  192. nnoremap <Leader>tv :vsp term://zsh<CR>
  193. nnoremap <Leader>to :term<CR>
  194. endif
  195. augroup formatting
  196. au!
  197. " strip trailing whitespace
  198. autocmd BufWritePre * :%s/\s\+$//e
  199. autocmd FileType markdown :set tw=80
  200. augroup end
  201. colorscheme seti
  202. if filereadable(expand('~/.vimrc.local'))
  203. source ~/.vimrc.local
  204. endif