-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc.bundles
428 lines (386 loc) · 12.6 KB
/
vimrc.bundles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
if &compatible
set nocompatible
end
" Shim command and function to allow migration from Vundle to vim-plug. {{{
function! VundleToPlug(vundle_command, arg, ...)
echom "You are using Vundle's `".a:vundle_command."` command to declare plugins. Dotfiles now uses vim-plug for plugin management. Please rename uses of `".a:vundle_command."` to `Plug`. Plugin was '".a:arg."'."
let vim_plug_options = {}
if a:0 > 0
if has_key(a:1, 'name')
let name = a:1.name
let vim_plug_options.dir = "$HOME/.vim/bundle/".a:1.name
endif
if has_key(a:1, 'rtp')
let vim_plug_options.rtp = a:1.rtp
endif
endif
Plug a:arg, vim_plug_options
endfunction
com! -nargs=+ -bar Plugin call VundleToPlug("Plugin", <args>)
com! -nargs=+ -bar Bundle call VundleToPlug("Bundle", <args>)
" }}}
call plug#begin()
" Tpopes' :) {{{
Plug 'tpope/vim-repeat'
" Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-surround'
let g:surround_no_insert_mappings = 1
imap <C-d> <Plug>Isurround
imap <C-e> <Plug>ISurround
Plug 'tpope/vim-abolish'
" MixedCase (crm)
" camelCase (crc)
" snake_case (crs) or (cr_)
" UPPER_CASE (cru)
" dash-case (cr-)
" dot.case (cr.)
" space case (cr<space>)
" Title Case (crt)
" }}}
" Git {{{
Plug 'mhinz/vim-signify'
let g:signify_vcs_list = ['git']
omap ic <plug>(signify-motion-inner-pending)
xmap ic <plug>(signify-motion-inner-visual)
omap ac <plug>(signify-motion-outer-pending)
xmap ac <plug>(signify-motion-outer-visual)
" nnoremap <leader>gt :SignifyToggle<CR>
" nnoremap <leader>gh :SignifyToggleHighlight<CR>
nmap ]g <plug>(signify-next-hunk)
nmap [g <plug>(signify-prev-hunk)
nmap ]G 9999]g
nmap [G 9999[g
" nnoremap <leader>gr :SignifyRefresh<CR>
Plug 'tpope/vim-fugitive'
nnoremap <Leader>gb :Git blame<CR>
Plug 'tpope/vim-rhubarb'
" :Gbrowse
" }}}
" kana/vim-textobj-user {{{
Plug 'kana/vim-textobj-user'
Plug 'fvictorio/vim-textobj-backticks' " a` | i`
Plug 'kana/vim-textobj-indent' " ai | ii
Plug 'sgur/vim-textobj-parameter' " a, | i,
Plug 'whatyouhide/vim-textobj-xmlattr' " ax | ix
Plug 'nelstrom/vim-textobj-rubyblock' " ar | ir
Plug 'bootleq/vim-textobj-rubysymbol' " a: | i:
Plug 'whatyouhide/vim-textobj-erb' " aE | iE
Plug 'thinca/vim-textobj-between' " af{char} | if{char}
Plug 'griffinqiu/vim-textobj-numeral' " an | in, ad | id
" }}}
" Tools, Such as nerdtree, vimwiki {{{
Plug 'skywind3000/vim-quickui'
Plug 'xfyuan/vim-mac-dictionary'
let g:vim_mac_dictionary_use_format = 1
nnoremap <silent><leader>ww :MacDictPopup<CR>
nnoremap <silent><leader>wd :MacDictWord<CR>
nnoremap <silent><leader>wq :MacDictQuery<CR>
Plug 'editorconfig/editorconfig-vim'
Plug 'christoomey/vim-sort-motion'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'diepm/vim-rest-console'
let b:vrc_header_content_type = 'application/json; charset=utf-8'
Plug 'rizzatti/dash.vim'
nmap <silent> <leader>d <Plug>DashSearch
Plug 'vim-scripts/matchit.zip'
Plug 'godlygeek/tabular'
vmap <leader>tz :Tabularize /=
Plug 'liangfeng/vimcdoc'
" }}}
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
nnoremap <silent> <leader>1 :NERDTreeToggle<CR>
nnoremap <silent> <leader>nf :NERDTreeFind<CR>
let g:NERDTreeMapPreview = "p"
let g:NERDTreeMapOpenSplit = "s"
let g:NERDTreeMapOpenVSplit = "v"
let g:NERDTreeMapOpenInTab = "t"
let g:NERDTreeMapToggleHidden = "I"
let g:NERDTreeMapJumpRoot = "<c-p>"
let g:NERDTreeMapJumpParent = "P"
let g:NERDTreeMapJumpFirstChild = "^"
let g:NERDTreeIgnore=['\.meta$', '\.pyc$']
let g:NERDTreeMapOpenExpl="<nop>"
" Set opened dir to workspace dir
let NERDTreeChDirMode = 2
" let NERDTreeWinPos = 'right'
let NERDTreeShowBookmarks = 1
let NERDTreeWinSize = 30
Plug 'Xuyuanp/nerdtree-git-plugin'
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' : '•',
\ 'Staged' : '✚',
\ 'Untracked' : 'ᵁ',
\ 'Renamed' : '≫',
\ 'Unmerged' : '≠',
\ 'Ignored' : 'ⁱ',
\ 'Deleted' : '✖',
\ 'Unknown' : '⁇'
\ }
Plug 'scrooloose/nerdcommenter'
let g:NERDSpaceDelims=1
Plug 'griffinqiu/star-search'
Plug 'griffinqiu/powerful-vim'
Plug 'dyng/ctrlsf.vim'
nmap <C-G>g <Plug>CtrlSFPrompt
nmap <C-G>G <Plug>CtrlSFCwordPath
nmap <C-G><C-G> <Plug>CtrlSFCwordExec
vmap <C-G>g <Plug>CtrlSFVwordPath
vmap <C-G><C-G> <Plug>CtrlSFVwordExec
nmap <C-G>p <Plug>CtrlSFPwordPath
nmap <C-G><C-P> <Plug>CtrlSFPwordExec
nnoremap <C-G><C-O> :CtrlSFOpen<CR>
nmap <C-G>l <Plug>CtrlSFQuickfixPrompt
vmap <C-G>l <Plug>CtrlSFQuilkfixVwordPath
vmap <C-G>L <Plug>CtrSFQuickfixVwordPath
vmap <C-G><C-L> <Plug>CtrlSFQuickfixVwordExec
nmap <silent><leader>3 :CtrlSFToggle<CR>
nnoremap \ :CtrlSF <SPACE>
let g:ctrlsf_mapping = {
\ "next": "<c-n>",
\ "prev": "<c-p>",
\ }
let g:ctrlsf_auto_close = 0
let g:ctrlsf_open_left = 0
let g:ctrlsf_position = 'right'
let g:ctrlsf_winsize = '30%'
"let g:ctrlsf_context = '-B 5 -A 3'
" let g:ctrlsf_debug_mode = 1
let g:ctrlsf_ignore_dir = ['node_modules', 'build', 'tmp', 'proto']
Plug 'terryma/vim-multiple-cursors'
let g:multi_cursor_start_key='<c-n>'
let g:multi_cursor_start_word_key='g<c-n>'
let g:multi_cursor_quit_key = '<Esc>'
Plug 'Lokaltog/vim-easymotion'
" let g:EasyMotion_leader_key = "'"
map ' <Plug>(easymotion-prefix)
nmap <Leader>' <Plug>(easymotion-overwin-w)
Plug 'ludovicchabant/vim-gutentags'
" Config g:gutentags_ctags_extra_args in ~/ctags.d/config.ctags
let g:gutentags_project_root = ['.root', '.svn', '.git', '.project']
let g:gutentags_cache_dir='~/.cache/nvim/backups'
let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_missing = 0
let g:gutentags_generate_on_new = 0
let g:gutentags_ctags_exclude_wildignore = 1
Plug 'Valloric/ListToggle'
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'
" }}}
" Rust, Golang {{{
Plug 'rust-lang/rust.vim'
Plug 'fatih/vim-go', { 'for': 'go', 'do': ':GoInstallBinaries' }
let g:go_fmt_fail_silently = 1
let g:go_highlight_trailing_whitespace_error = 0
" " let g:go_addtags_transform = "camelcase"
let g:go_list_height = 10
" " let g:go_list_type='locationlist'
let g:go_def_mapping_enabled = 0
let g:go_auto_sameids = 0
let g:go_code_completion_enabled = 0
" " run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
" Mappings or Tips
" - <c-x><c-o>
" - <c-]>
" - vif
" - gJ
" - gS
" - GoDoc
" - GoDocBrowser
" - GoDef
" - gd or c-]
" - c-t
" - c-o
" - c-i
" - GoDefStack
" - GoSameIds
" - GoRename
" - GoFreevars
" - GoReferrers
" - GoDescribe
" - GoImplements
" - GoWhicherrs
" - GoChannelPeers
" - GoCallees
" - GoCallers
" - GoImpl
" - GoPlay
autocmd FileType go nmap <leader>go <Plug>(go-imports)
autocmd FileType go nmap <leader>gg :<C-u>call <SID>build_go_files()<CR>
autocmd FileType go nmap <leader>gO :GoImport<SPACE>
autocmd FileType go nmap <leader>gd :GoDeclsDir<cr>
autocmd FileType go nmap <Leader>gh <Plug>(go-info)
autocmd FileType go nmap <leader>gc <Plug>(go-coverage-toggle)
" " autocmd FileType go nmap <leader>gi <Plug>(go-implements)
" " autocmd FileType go nmap <Leader>gs <Plug>(go-sameids-toggle)
" " autocmd FileType go nmap <leader>gb <Plug>(go-build)
" " autocmd FileType go nmap <leader>gf <Plug>(go-test-func)
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
" " autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
Plug 'Shougo/vimshell.vim', { 'for': 'go' }
Plug 'Shougo/vimproc.vim', { 'for': 'go', 'do' : 'make'}
Plug 'sebdah/vim-delve', { 'for': 'go' }
" }}}
" Syntax {{{
" Plug 'rstacruz/vim-hyperstyle'
" Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
" Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'mxw/vim-jsx', { 'for': 'javascript' }
Plug 'chrisbra/csv.vim'
Plug 'posva/vim-vue'
" autocmd BufRead,BufNewFile *.vue set filetype=vue
let g:vue_pre_processors = []
autocmd FileType vue MatchDebug
let g:ft = ''
fu! NERDCommenter_before()
if &ft == 'vue'
let g:ft = 'vue'
let stack = synstack(line('.'), col('.'))
if len(stack) > 0
let syn = synIDattr((stack)[0], 'name')
if len(syn) > 0
let syn = tolower(syn)
exe 'setf '.syn
endif
endif
endif
endfu
fu! NERDCommenter_after()
if g:ft == 'vue'
setf vue
g:ft
endif
endfu
Plug 'Keithbsmiley/rspec.vim', { 'for': 'ruby' }
Plug 'ecomba/vim-ruby-refactoring', { 'for': 'ruby' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'tpope/vim-rails', { 'for': ['ruby', 'eruby'] }
Plug 'tpope/vim-rbenv', { 'for': 'ruby' }
Plug 'tpope/vim-bundler', { 'for': 'ruby' }
Plug 'tpope/vim-pathogen', { 'for': 'ruby' }
" Plug 'griffinqiu/vim-i18n'
" vmap <leader>zz :call I18nTranslateString()<CR>
" vmap <leader>zd :call I18nDisplayTranslation()<CR>
Plug 'AndrewRadev/switch.vim'
let g:switch_mapping = "-"
Plug 'plasticboy/vim-markdown'
Plug 'mzlogin/vim-markdown-toc'
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_initial_foldlevel=1
" }}}
" Snips {{{
" Plug 'SirVer/ultisnips'
" let g:UltiSnipsExpandTrigger="<tab>"
" " link to fzf Snippets
" let g:UltiSnipsJumpForwardTrigger="<c-j>"
" let g:UltiSnipsJumpBackwardTrigger="<c-k>"
" let g:UltiSnipsEditSplit="vertical"
" nnoremap <silent> <leader>uu :UltiSnipsEdit<cr>
" nnoremap <silent> <leader>ue :UltiSnipsEdit<space>
" Plug 'griffinqiu/vim-snippets'
Plug 'mattn/emmet-vim'
" let g:user_emmet_mode='i'
let g:user_emmet_mode='i'
autocmd FileType html,css,less,sass,eruby,erb,javascript,jsx,vue EmmetInstall
let g:user_emmet_leader_key='<c-e>'
let g:user_emmet_expandabbr_key='<c-e><c-e>'
let g:user_emmet_expandword_key = '<C-e>v'
let g:user_emmet_update_tag = '<C-e>u'
let g:user_emmet_next_key='<C-e>n'
let g:user_emmet_prev_key='<C-e>p'
let g:user_emmet_settings = {
\ 'html' : {
\ 'quote_char': "'",
\ },
\ 'javascript' : {
\ 'extends' : 'jsx',
\ }
\}
" }}}
" Theme {{{
" Plug 'yonchu/accelerated-smooth-scroll'
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
" let g:airline_statusline_ontop=1
let airline#extensions#gutentags#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.colnr = ':'
" " Useage
" " 1. Chose theme in vim
" " :Tmuxline airline righteous
" " 2. Save snapshot to tmux.conf
" " :TmuxlineSnapshot! ~/dotfiles/tmux-style.conf
" Plug 'edkolev/tmuxline.vim'
" }}}
" LSP {{{
Plug 'github/copilot.vim'
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
let b:copilot_enabled = 1
" }}}
" if !has("gui_macvim")
" source ~/.vimrc.coc
" endif
call plug#end()
" call defx#custom#option('_', {
" \ 'columns': 'indent:git:icons:filename',
" \ 'winwidth': 25,
" \ 'split': 'vertical',
" \ 'toggle': 1,
" \ 'direction': 'topleft',
" \ 'listed': 1,
" \ 'show_ignored_files': 0,
" \ 'root_marker': '≡ ',
" \ 'ignored_files':
" \ '.mypy_cache,.pytest_cache,.git,.hg,.svn,.stversions'
" \ . ',__pycache__,.sass-cache,*.egg-info,.DS_Store,*.pyc,*.swp'
" \ })
"
nnoremap \h :let Value=<C-R><C-W><CR>
nnoremap \p :if exists('Value')<Bar>normal i<C-R>=Value<CR><Esc><Bar>:endif<CR>
command! -nargs=? -range Dec2hex call s:Dec2hex(<line1>, <line2>, '<args>')
function! s:Dec2hex(line1, line2, arg) range
if empty(a:arg)
if histget(':', -1) =~# "^'<,'>" && visualmode() !=# 'V'
let cmd = 's/\%V\<\d\+\>/\=printf("0x%x",submatch(0)+0)/g'
else
let cmd = 's/\<\d\+\>/\=printf("0x%x",submatch(0)+0)/g'
endif
try
execute a:line1 . ',' . a:line2 . cmd
catch
echo 'Error: No decimal number found'
endtry
else
echo printf('%x', a:arg + 0)
endif
endfunction
command! -nargs=? -range Hex2dec call s:Hex2dec(<line1>, <line2>, '<args>')
function! s:Hex2dec(line1, line2, arg) range
if empty(a:arg)
if histget(':', -1) =~# "^'<,'>" && visualmode() !=# 'V'
let cmd = 's/\%V0x\x\+/\=submatch(0)+0/g'
else
let cmd = 's/0x\x\+/\=submatch(0)+0/g'
endif
try
execute a:line1 . ',' . a:line2 . cmd
catch
echo 'Error: No hex number starting "0x" found'
endtry
else
echo (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0
endif
endfunction