init.vim 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. " set wordwrap indent
  134. set nowrap
  135. set linebreak
  136. if exists("&breakindent")
  137. set breakindent
  138. set breakindentopt=shift:2,sbr
  139. endif
  140. " show whitespace
  141. set list
  142. " make a new copy of the file for backup
  143. " setting to no or auto messes with filewatchers
  144. set backupcopy=yes
  145. " ------ key bindings ------
  146. " ; as :
  147. nnoremap ; :
  148. vnoremap ; :
  149. " allow <ESC> via jj in insert mode
  150. inoremap jj <ESC>
  151. " fix j/k with wraps
  152. nnoremap j gj
  153. nnoremap k gk
  154. vnoremap j gj
  155. vnoremap k gk
  156. " opening unite
  157. nnoremap <C-P> :Denite file_rec<cr>
  158. nnoremap <C-O> :Denite buffer<cr>
  159. imap <C-W> <ESC><C-W>
  160. nnoremap <C-T>h :tabprev<cr>
  161. nnoremap <C-T>l :tabnext<cr>
  162. " grepper
  163. nnoremap <Leader>f :Denite -mode=normal grep:.<CR>
  164. " git
  165. nnoremap <Leader>gs :Gstatus<CR>
  166. nnoremap <Leader>gb :Merginal<CR>
  167. " undo tree
  168. nnoremap <Leader>ut :GundoToggle<CR>
  169. " vimrc
  170. nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
  171. nnoremap <Leader>vs :source $MYVIMRC<CR>
  172. " ------ nvim specific ------
  173. if has('nvim')
  174. set inccommand=split
  175. let g:airline_theme_patch_func = 'AirlineThemePatch'
  176. function! AirlineThemePatch(palette)
  177. let a:palette.terminal = copy(a:palette.insert)
  178. endfunction
  179. let g:terminal_scrollback_buffer_size = 10000
  180. tnoremap <C-j><C-j> <C-\><C-N>
  181. tmap <C-T> <C-\><C-N><C-T>
  182. tmap <C-W> <C-\><C-N><C-W>
  183. tmap <C-P> <C-\><C-N><C-P>
  184. tmap <C-O> <C-\><C-N><C-O>
  185. tnoremap <C-V><C-V><C-V> <C-V><C-V>
  186. tnoremap <C-V><C-V> <C-V>
  187. tnoremap <C-V> <C-\><C-N>"+pi
  188. autocmd BufWinEnter,WinEnter term://* startinsert
  189. autocmd BufLeave term://* stopinsert
  190. nnoremap <Leader>tv :vsp term://zsh<CR>
  191. nnoremap <Leader>to :term<CR>
  192. endif
  193. augroup formatting
  194. au!
  195. " strip trailing whitespace
  196. autocmd BufWritePre * :%s/\s\+$//e
  197. autocmd FileType markdown :set tw=80
  198. augroup end
  199. colorscheme seti
  200. if filereadable(expand('~/.vimrc.local'))
  201. source ~/.vimrc.local
  202. endif