forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.vim
428 lines (375 loc) · 15.3 KB
/
all.vim
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
" Plugin Keyboard-Mappings
" ---
if dein#tap('denite.nvim')
nnoremap <silent><LocalLeader>r :<C-u>Denite -resume -refresh -no-start-filter<CR>
nnoremap <silent><LocalLeader>f :<C-u>Denite file/rec<CR>
nnoremap <silent><LocalLeader>g :<C-u>Denite grep -start-filter<CR>
nnoremap <silent><LocalLeader>b :<C-u>Denite buffer -default-action=switch<CR>
nnoremap <silent><LocalLeader>i :<C-u>Denite file/old<CR>
nnoremap <silent><LocalLeader>d :<C-u>Denite directory_rec directory_mru -default-action=cd<CR>
nnoremap <silent><LocalLeader>v :<C-u>Denite neoyank -buffer-name=register<CR>
xnoremap <silent><LocalLeader>v :<C-u>Denite neoyank -buffer-name=register -default-action=replace<CR>
nnoremap <silent><LocalLeader>l :<C-u>Denite location_list -buffer-name=list -no-start-filter<CR>
nnoremap <silent><LocalLeader>q :<C-u>Denite quickfix -buffer-name=list -no-start-filter<CR>
nnoremap <silent><LocalLeader>m :<C-u>Denite mark<CR>
nnoremap <silent><LocalLeader>n :<C-u>Denite dein<CR>
nnoremap <silent><LocalLeader>j :<C-u>Denite jump change file/point -no-start-filter<CR>
nnoremap <silent><LocalLeader>u :<C-u>Denite junkfile:new junkfile -buffer-name=list<CR>
nnoremap <silent><LocalLeader>o :<C-u>Denite outline -no-start-filter<CR>
nnoremap <silent><LocalLeader>s :<C-u>Denite session -buffer-name=list<CR>
nnoremap <silent><LocalLeader>t :<C-u>Denite tag<CR>
nnoremap <silent><LocalLeader>p :<C-u>Denite jump<CR>
nnoremap <silent><LocalLeader>h :<C-u>Denite help<CR>
nnoremap <silent><LocalLeader>w :<C-u>Denite file/rec -buffer-name=memo -path=~/docs/blog<CR>
nnoremap <silent><LocalLeader>x :<C-u>Denite file_mru<CR>
nnoremap <silent><LocalLeader>z :<C-u>Denite z -buffer-name=list<CR>
nnoremap <silent><LocalLeader>; :<C-u>Denite command_history command<CR>
nnoremap <silent><expr><LocalLeader>/ wordcount().chars > 10000 ?
\ ":\<C-u>Denite -search line/external\<CR>"
\ : ":\<C-u>Denite -search line\<CR>"
nnoremap <silent><expr><LocalLeader>* wordcount().chars > 10000 ?
\ ":\<C-u>DeniteCursorWord -no-start-filter -search line/external\<CR>"
\ : ":\<C-u>DeniteCursorWord -no-start-filter -search line\<CR>"
" Open Denite with word under cursor or selection
nnoremap <silent> <Leader>gt :DeniteCursorWord tag:include -no-start-filter -immediately<CR>
nnoremap <silent> <Leader>gf :DeniteCursorWord file/rec -no-start-filter<CR>
nnoremap <silent> <Leader>gg :DeniteCursorWord grep -no-start-filter<CR>
vnoremap <silent> <Leader>gg
\ :<C-u>call <SID>get_selection('/')<CR>
\ :execute 'Denite -no-start-filter grep:::'.escape(@/, ' :')<CR><CR>
function! s:get_selection(cmdtype)
let temp = @s
normal! gv"sy
let @/ = substitute(escape(@s, '\' . a:cmdtype), '\n', '\\n', 'g')
let @s = temp
endfunction
endif
if dein#tap('vim-clap')
" nnoremap <silent><LocalLeader>f :<C-u>Clap! files<CR>
" nnoremap <silent><LocalLeader>b :<C-u>Clap! buffers<CR>
" nnoremap <silent><LocalLeader>g :<C-u>Clap! grep<CR>
" nnoremap <silent><LocalLeader>j :<C-u>Clap! jumps<CR>
" nnoremap <silent><LocalLeader>h :<C-u>Clap! help_tags<CR>
" nnoremap <silent><LocalLeader>t :<C-u>Clap! tags<CR>
" nnoremap <silent><LocalLeader>l :<C-u>Clap! loclist<CR>
" nnoremap <silent><LocalLeader>q :<C-u>Clap! quickfix<CR>
" nnoremap <silent><LocalLeader>m :<C-u>Clap! files ~/docs/books<CR>
" nnoremap <silent><LocalLeader>y :<C-u>Clap! yanks<CR>
" nnoremap <silent><LocalLeader>/ :<C-u>Clap! lines<CR>
" nnoremap <silent><LocalLeader>* :<C-u>Clap! lines ++query=<cword><CR>
" nnoremap <silent><LocalLeader>; :<C-u>Clap! command_history<CR>
" nnoremap <silent><Leader>gl :<C-u>Clap! commits<CR>
" nnoremap <silent><Leader>gt :<C-u>Clap! tags ++query=<cword><CR>
" xnoremap <silent><Leader>gt :<C-u>Clap! tags ++query=@visual<CR><CR>
" nnoremap <silent><Leader>gf :<C-u>Clap! files ++query=<cword><CR>
" xnoremap <silent><Leader>gf :<C-u>Clap! files ++query=@visual<CR><CR>
" nnoremap <silent><Leader>gg :<C-u>Clap! grep ++query=<cword><CR>
" xnoremap <silent><Leader>gg :<C-u>Clap! grep ++query=@visual<CR><CR>
autocmd user_events FileType clap_input call s:clap_mappings()
function! s:clap_mappings()
nnoremap <silent> <buffer> <nowait> <Space> :call clap#handler#tab_action()<CR>
nnoremap <silent> <buffer> <nowait>' :call clap#handler#tab_action()<CR>
inoremap <silent> <buffer> <Tab> <C-R>=clap#navigation#linewise('down')<CR>
inoremap <silent> <buffer> <S-Tab> <C-R>=clap#navigation#linewise('up')<CR>
nnoremap <silent> <buffer> <C-j> :<C-u>call clap#navigation#linewise('down')<CR>
nnoremap <silent> <buffer> <C-k> :<C-u>call clap#navigation#linewise('up')<CR>
nnoremap <silent> <buffer> <C-n> :<C-u>call clap#navigation#linewise('down')<CR>
nnoremap <silent> <buffer> <C-p> :<C-u>call clap#navigation#linewise('up')<CR>
nnoremap <silent> <buffer> <C-f> :<c-u>call clap#navigation#scroll('down')<CR>
nnoremap <silent> <buffer> <C-b> :<c-u>call clap#navigation#scroll('up')<CR>
nnoremap <silent> <buffer> sg :<c-u>call clap#handler#try_open('ctrl-v')<CR>
nnoremap <silent> <buffer> sv :<c-u>call clap#handler#try_open('ctrl-x')<CR>
nnoremap <silent> <buffer> st :<c-u>call clap#handler#try_open('ctrl-t')<CR>
nnoremap <silent> <buffer> q :<c-u>call clap#handler#exit()<CR>
nnoremap <silent> <buffer> <Esc> :call clap#handler#exit()<CR>
inoremap <silent> <buffer> <Esc> <C-R>=clap#navigation#linewise('down')<CR><C-R>=clap#navigation#linewise('up')<CR><Esc>
inoremap <silent> <buffer> jj <C-R>=clap#navigation#linewise('down')<CR><C-R>=clap#navigation#linewise('up')<CR><Esc>
endfunction
endif
if dein#tap('vim-lsp')
" Close preview window with Escape
autocmd User lsp_float_opened
\ nmap <buffer> <silent> <Esc> <Plug>(lsp-preview-close)
autocmd User lsp_float_closed silent! nunmap <buffer> <Esc>
autocmd user_events FileType markdown.lsp-hover
\ nmap <silent><buffer>q :pclose<CR>| doautocmd <nomodeline> BufWinEnter
endif
if dein#tap('defx.nvim')
nnoremap <silent> <LocalLeader>e
\ :<C-u>Defx -toggle -buffer-name=explorer`tabpagenr()`<CR>
nnoremap <silent> <LocalLeader>a
\ :<C-u>Defx
\ -search=`escape(expand('%:p'), ' :')`
\ -buffer-name=explorer`tabpagenr()`<CR>
endif
if dein#tap('delimitMate')
imap <buffer><expr> <C-Tab> delimitMate#JumpAny()
endif
if dein#tap('vista.vim')
nnoremap <silent> <Leader>b :<C-u>Vista<CR>
nnoremap <silent> <Leader>a :<C-u>Vista show<CR>
endif
if dein#tap('emmet-vim')
autocmd user_events FileType html,css,javascript,javascriptreact,svelte
\ EmmetInstall
\ | imap <buffer> <C-Return> <Plug>(emmet-expand-abbr)
endif
if dein#tap('vim-gitgutter')
nmap ]g <Plug>(GitGutterNextHunk)
nmap [g <Plug>(GitGutterPrevHunk)
nmap gS <Plug>(GitGutterStageHunk)
xmap gS <Plug>(GitGutterStageHunk)
nmap <Leader>gr <Plug>(GitGutterUndoHunk)
nmap gs <Plug>(GitGutterPreviewHunk)
endif
if dein#tap('iron.nvim')
nmap <silent> <Leader>rr :<C-u>IronRepl<CR><Esc>
nmap <silent> <Leader>rq <Plug>(iron-exit)
nmap <silent> <Leader>rl <Plug>(iron-send-line)
vmap <silent> <Leader>rl <Plug>(iron-visual-send)
nmap <silent> <Leader>rp <Plug>(iron-repeat-cmd)
nmap <silent> <Leader>rc <Plug>(iron-clear)
nmap <silent> <Leader>r<CR> <Plug>(iron-cr)
nmap <silent> <Leader>r<Esc> <Plug>(iron-interrupt)
endif
if dein#tap('vim-sandwich')
nmap <silent> sa <Plug>(operator-sandwich-add)
xmap <silent> sa <Plug>(operator-sandwich-add)
omap <silent> sa <Plug>(operator-sandwich-g@)
nmap <silent> sd <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
xmap <silent> sd <Plug>(operator-sandwich-delete)
nmap <silent> sr <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
xmap <silent> sr <Plug>(operator-sandwich-replace)
nmap <silent> sdb <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
nmap <silent> srb <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
omap ir <Plug>(textobj-sandwich-auto-i)
xmap ir <Plug>(textobj-sandwich-auto-i)
omap ab <Plug>(textobj-sandwich-auto-a)
xmap ab <Plug>(textobj-sandwich-auto-a)
omap is <Plug>(textobj-sandwich-query-i)
xmap is <Plug>(textobj-sandwich-query-i)
omap as <Plug>(textobj-sandwich-query-a)
xmap as <Plug>(textobj-sandwich-query-a)
endif
if dein#tap('vim-operator-replace')
xmap p <Plug>(operator-replace)
endif
if dein#tap('vim-niceblock')
silent! xmap I <Plug>(niceblock-I)
silent! xmap gI <Plug>(niceblock-gI)
silent! xmap A <Plug>(niceblock-A)
endif
if dein#tap('accelerated-jk')
nmap <silent> j <Plug>(accelerated_jk_gj)
nmap <silent> k <Plug>(accelerated_jk_gk)
endif
if dein#tap('vim-edgemotion')
map gj <Plug>(edgemotion-j)
map gk <Plug>(edgemotion-k)
xmap gj <Plug>(edgemotion-j)
xmap gk <Plug>(edgemotion-k)
endif
if dein#tap('vim-quickhl')
nmap <Leader>mt <Plug>(quickhl-manual-this)
xmap <Leader>mt <Plug>(quickhl-manual-this)
endif
if dein#tap('vim-sidemenu')
nmap <Leader>l <Plug>(sidemenu)
xmap <Leader>l <Plug>(sidemenu-visual)
endif
if dein#tap('vim-indent-guides')
nmap <silent><Leader>ti :<C-u>IndentGuidesToggle<CR>
endif
if dein#tap('vim-signature')
let g:SignatureIncludeMarks = 'abcdefghijkloqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
let g:SignatureMap = {
\ 'Leader': 'm',
\ 'ListBufferMarks': 'm/',
\ 'ListBufferMarkers': 'm?',
\ 'PlaceNextMark': 'm,',
\ 'ToggleMarkAtLine': 'mm',
\ 'PurgeMarksAtLine': 'm-',
\ 'DeleteMark': 'dm',
\ 'PurgeMarks': 'm<Space>',
\ 'PurgeMarkers': 'm<BS>',
\ 'GotoNextLineAlpha': "']",
\ 'GotoPrevLineAlpha': "'[",
\ 'GotoNextSpotAlpha': '`]',
\ 'GotoPrevSpotAlpha': '`[',
\ 'GotoNextLineByPos': "]'",
\ 'GotoPrevLineByPos': "['",
\ 'GotoNextSpotByPos': 'mn',
\ 'GotoPrevSpotByPos': 'mp',
\ 'GotoNextMarker': ']-',
\ 'GotoPrevMarker': '[-',
\ 'GotoNextMarkerAny': ']=',
\ 'GotoPrevMarkerAny': '[=',
\ }
endif
if dein#tap('auto-git-diff')
autocmd user_events FileType gitrebase
\ nmap <buffer><CR> <Plug>(auto_git_diff_scroll_manual_update)
\| nmap <buffer><C-n> <Plug>(auto_git_diff_scroll_down_page)
\| nmap <buffer><C-p> <Plug>(auto_git_diff_scroll_up_page)
\| nmap <buffer><C-d> <Plug>(auto_git_diff_scroll_down_half)
\| nmap <buffer><C-u> <Plug>(auto_git_diff_scroll_up_half)
endif
if dein#tap('committia.vim')
let g:committia_hooks = {}
function! g:committia_hooks.edit_open(info)
setlocal winminheight=1 winheight=10
resize 10
imap <buffer><C-d> <Plug>(committia-scroll-diff-down-half)
imap <buffer><C-u> <Plug>(committia-scroll-diff-up-half)
imap <buffer><C-f> <Plug>(committia-scroll-diff-down-page)
imap <buffer><C-b> <Plug>(committia-scroll-diff-up-page)
imap <buffer><C-j> <Plug>(committia-scroll-diff-down)
imap <buffer><C-k> <Plug>(committia-scroll-diff-up)
endfunction
endif
if dein#tap('python_match.vim')
autocmd user_events FileType python
\ nmap <buffer> {{ [%
\ | nmap <buffer> }} ]%
endif
if dein#tap('goyo.vim')
nnoremap <Leader>G :Goyo<CR>
endif
if dein#tap('vim-shot-f')
nmap f <Plug>(shot-f-f)
nmap F <Plug>(shot-f-F)
nmap t <Plug>(shot-f-t)
nmap T <Plug>(shot-f-T)
xmap f <Plug>(shot-f-f)
xmap F <Plug>(shot-f-F)
xmap t <Plug>(shot-f-t)
xmap T <Plug>(shot-f-T)
omap f <Plug>(shot-f-f)
omap F <Plug>(shot-f-F)
omap t <Plug>(shot-f-t)
omap T <Plug>(shot-f-T)
endif
if dein#tap('vimwiki')
nnoremap <silent> <Leader>W :<C-u>VimwikiIndex<CR>
endif
if dein#tap('vim-choosewin')
nmap - <Plug>(choosewin)
nmap <Leader>- :<C-u>ChooseWinSwapStay<CR>
endif
if dein#tap('vimagit')
nnoremap <silent> <Leader>mg :Magit<CR>
endif
if dein#tap('gina.vim')
nnoremap <silent> <leader>ga :Gina add %:p<CR>
nnoremap <silent> <leader>gd :Gina compare<CR>
nnoremap <silent> <leader>gc :Gina commit<CR>
nnoremap <silent> <leader>gb :Gina blame --width=40<CR>
nnoremap <silent> <leader>gs :Gina status -s<CR>
nnoremap <silent> <leader>gl :Gina log --graph --all<CR>
nnoremap <silent> <leader>gF :Gina! fetch<CR>
nnoremap <silent> <leader>gp :Gina! push<CR>
nnoremap <silent> <leader>go :,Gina browse :<CR>
vnoremap <silent> <leader>go :Gina browse :<CR>
endif
if dein#tap('vim-altr')
nmap <leader>n <Plug>(altr-forward)
nmap <leader>N <Plug>(altr-back)
endif
if dein#tap('any-jump.vim')
" Normal mode: Jump to definition under cursor
nnoremap <silent> <leader>ii :AnyJump<CR>
" Visual mode: jump to selected text in visual mode
xnoremap <silent> <leader>ii :AnyJumpVisual<CR>
" Normal mode: open previous opened file (after jump)
nnoremap <silent> <leader>ib :AnyJumpBack<CR>
" Normal mode: open last closed search window again
nnoremap <silent> <leader>il :AnyJumpLastResults<CR>
endif
if dein#tap('undotree')
nnoremap <Leader>gu :UndotreeToggle<CR>
endif
if dein#tap('thesaurus_query.vim')
nnoremap <silent> <Leader>K :<C-u>ThesaurusQueryReplaceCurrentWord<CR>
endif
if dein#tap('vim-asterisk')
map * <Plug>(asterisk-g*)
map g* <Plug>(asterisk-*)
map # <Plug>(asterisk-g#)
map g# <Plug>(asterisk-#)
map z* <Plug>(asterisk-z*)
map gz* <Plug>(asterisk-gz*)
map z# <Plug>(asterisk-z#)
map gz# <Plug>(asterisk-gz#)
endif
if dein#tap('vim-expand-region')
xmap v <Plug>(expand_region_expand)
xmap V <Plug>(expand_region_shrink)
endif
if dein#tap('sideways.vim')
nnoremap <silent> <, :SidewaysLeft<CR>
nnoremap <silent> >, :SidewaysRight<CR>
nnoremap <silent> [, :SidewaysJumpLeft<CR>
nnoremap <silent> ], :SidewaysJumpRight<CR>
omap <silent> a, <Plug>SidewaysArgumentTextobjA
xmap <silent> a, <Plug>SidewaysArgumentTextobjA
omap <silent> i, <Plug>SidewaysArgumentTextobjI
xmap <silent> i, <Plug>SidewaysArgumentTextobjI
endif
if dein#tap('splitjoin.vim')
let g:splitjoin_join_mapping = ''
let g:splitjoin_split_mapping = ''
nmap sj :SplitjoinJoin<CR>
nmap sk :SplitjoinSplit<CR>
endif
if dein#tap('linediff.vim')
vnoremap <Leader>mdf :Linediff<CR>
vnoremap <Leader>mda :LinediffAdd<CR>
nnoremap <Leader>mds :<C-u>LinediffShow<CR>
nnoremap <Leader>mdr :<C-u>LinediffReset<CR>
endif
if dein#tap('dsf.vim')
nmap dsf <Plug>DsfDelete
nmap csf <Plug>DsfChange
endif
if dein#tap('caw.vim')
function! InitCaw() abort
if &l:modifiable && &buftype ==# '' && &filetype != 'gitrebase'
xmap <buffer> <Leader>V <Plug>(caw:wrap:toggle)
nmap <buffer> <Leader>V <Plug>(caw:wrap:toggle)
xmap <buffer> <Leader>v <Plug>(caw:hatpos:toggle)
nmap <buffer> <Leader>v <Plug>(caw:hatpos:toggle)
nmap <buffer> gc <Plug>(caw:prefix)
xmap <buffer> gc <Plug>(caw:prefix)
nmap <buffer> gcc <Plug>(caw:hatpos:toggle)
xmap <buffer> gcc <Plug>(caw:hatpos:toggle)
else
silent! nunmap <buffer> <Leader>V
silent! xunmap <buffer> <Leader>V
silent! nunmap <buffer> <Leader>v
silent! xunmap <buffer> <Leader>v
silent! nunmap <buffer> gc
silent! xunmap <buffer> gc
silent! nunmap <buffer> gcc
silent! xunmap <buffer> gcc
endif
endfunction
autocmd user_events FileType * call InitCaw()
call InitCaw()
endif
if dein#tap('fin.vim')
nnoremap <Leader>f :<C-u>Fin<CR>
function! InitFin() abort
cmap <buffer><nowait> <Tab> <Plug>(fin-line-next)
cmap <buffer><nowait> <S-Tab> <Plug>(fin-line-prev)
cmap <buffer><nowait> <C-j> <Plug>(fin-line-next)
cmap <buffer><nowait> <C-k> <Plug>(fin-line-prev)
endfunction
autocmd user_events FileType fin call InitFin()
endif
if dein#tap('vim-textobj-function')
omap <silent> af <Plug>(textobj-function-a)
omap <silent> if <Plug>(textobj-function-i)
xmap <silent> af <Plug>(textobj-function-a)
xmap <silent> if <Plug>(textobj-function-i)
endif
" vim: set ts=2 sw=2 tw=80 noet :