-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinit.vim
498 lines (439 loc) · 15.4 KB
/
init.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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
" -*- mode: vimrc -*-
let mapleader = " "
set clipboard+=unnamed
set commentary
set history
set ignorecase
set matchpairs
set multiple-cursors
set number
set relativenumber
set smartcase
set surround
set wrapscan
" IdeaVim only
set ideajoin=true
set idearefactormode=visual
set ideavimsupport=
" evil-escape
imap jk <Esc>
" Insert newline above
nnoremap [<Space> O<Esc>j
vnoremap [<Space> <Esc>O<Esc>j
let g:WhichKeyDesc_insert_newline_above = '[<Space> Insert newline above'
" Insert newline below
nnoremap ]<Space> o<Esc>k
vnoremap ]<Space> <Esc>o<Esc>k
let g:WhichKeyDesc_insert_newline_below = ']<Space> Insert newline below'
" Close all folds
nmap zm <Action>(CollapseAllRegions)
" Open all folds
nmap zr <Action>(ExpandAllRegions)
" doom-escape-hook
nnoremap <Esc> :<C-u>nohl<CR>:<C-u>action HideAllWindows<CR><Esc>
"
" Hybrid mode
" Go to first character
inoremap <C-a> <Esc>I
cnoremap <C-a> <Home>
" Go left
inoremap <C-b> <Left>
" Delete character
inoremap <C-d> <Del>
" Go to end of line
inoremap <C-e> <Esc>A
cnoremap <C-e> <End>
" Go right
inoremap <C-f> <Right>
" Unbind C-g
noremap <C-g> <Esc>
inoremap <C-g> <Nop>
" Delete to line end
inoremap <C-k> <Esc>:action EditorDeleteToLineEnd<CR>a
" Go down
inoremap <C-n> <Down>
" Go up
inoremap <C-p> <Up>
" Go to previous word
inoremap <A-b> <Esc>:action EditorPreviousWord<CR>i
" Go to next word
inoremap <A-f> <Esc>:action EditorNextWord<CR>a
"
" +leader
" Search project
map <Leader>/ <Action>(FindInPath)
let g:WhichKeyDesc_search_project1 = '<leader>/ Search project'
" Find file
map <Leader>. <Action>(SearchEverywhere)
let g:WhichKeyDesc_find_file1 = '<leader>. Find file'
" Jump to bookmark
map <Leader><CR> <Action>(Bookmarks)
let g:WhichKeyDesc_jump_to_bookmark = '<leader>⏎ Jump to bookmark'
" Switch buffer
map <Leader>< <Action>(Switcher)
let g:WhichKeyDesc_switch_buffer = '<leader>< Switch buffer'
" Switch to last buffer
map <Leader>` <Action>(GoToLastTab)
let g:WhichKeyDesc_switch_to_last_buffer = '<leader>` Switch to last buffer'
" Toggle last popup
map <Leader>~ <Action>(JumpToLastWindow)
let g:WhichKeyDesc_toggle_last_popup = '<leader>~ Toggle last popup'
"
" +buffer
let g:WhichKeyDesc_buffer = '<leader>b +buffer'
" Switch workspace buffer
map <leader>bb <Action>(RecentFiles)
let g:WhichKeyDesc_switch_workspace_buffer = '<leader>bb Switch workspace buffer'
" Kill buffer
map <Leader>bd <Action>(CloseContent)
let g:WhichKeyDesc_kill_buffer1 = '<leader>bd Kill buffer'
" Kill buffer
map <Leader>bk <Action>(CloseContent)
let g:WhichKeyDesc_kill_buffer2 = '<leader>bk Kill buffer'
" Save buffer
noremap <Leader>bs :<C-u>w<CR>
let g:WhichKeyDesc_save_buffer = '<leader>bs Save buffer'
" Kill all buffers
map <Leader>bK <Action>(CloseAllEditors)
let g:WhichKeyDesc_kill_all_buffers = '<leader>bK Kill all buffers'
" New empty buffer
map <Leader>bN <Action>(NewScratchBuffer)
let g:WhichKeyDesc_new_empty_buffer = '<leader>bN New empty buffer'
" Kill other buffers
map <Leader>bO <Action>(CloseAllEditorsButActive)
let g:WhichKeyDesc_kill_other_buffers = '<leader>bO Kill other buffers'
" Save all buffers
noremap <Leader>bS :<C-u>wa<CR>
let g:WhichKeyDesc_save_all_buffers = '<leader>bS Save all buffers'
"
" +code
let g:WhichKeyDesc_code_leader = '<leader>c +code'
" Jump to references
map <Leader>cD <Action>(ShowUsages)
let g:WhichKeyDesc_jump_to_refs = '<leader>cD Jump to references'
" Execute Intention Action
map <Leader>ca <Action>(ShowIntentionActions)
let g:WhichKeyDesc_exec_intention_action = '<leader>ca Execute Intention Action'
" Compile
map <Leader>cc <Action>(CompileDirty)
let g:WhichKeyDesc_compile = '<leader>cc Compile'
" Jump to definition
noremap <Leader>cd gd
let g:WhichKeyDesc_jump_to_def1 = 'gd Jump to definition'
let g:WhichKeyDesc_jump_to_def2 = '<leader>cd Jump to definition'
" Format buffer/region
nmap <Leader>cf <Action>(ReformatCode)
let g:WhichKeyDesc_format_buffer_region = '<leader>cf Format buffer/region'
" Find implementations
map <Leader>ci <Action>(GotoImplementation)
let g:WhichKeyDesc_find_impls = '<leader>ci Find implementations'
" Jump to symbol in current workspace
map <Leader>cj <Action>(SearchEverywhere)
let g:WhichKeyDesc_jump_to_symbol_in_current_workspace = '<leader>cj Jump to symbol in current workspace'
" Show documentation
map <Leader>ck <Action>(QuickJavaDoc)
let g:WhichKeyDesc_show_doc = '<leader>ck Show documentation'
" Organize imports
map <Leader>co <Action>(OptimizeImports)
let g:WhichKeyDesc_organize_imports = '<leader>co Organize imports'
" Rename
map <Leader>cr <Action>(RenameElement)
let g:WhichKeyDesc_rename = '<leader>cr Rename'
" Find type definition
map <Leader>ct <Action>(GotoTypeDeclaration)
let g:WhichKeyDesc_find_type_def = '<leader>ct Find type definition'
" Recompile
map <Leader>cC <Action>(Compile)
let g:WhichKeyDesc_recompile = '<leader>cC Recompile'
" Go to previous error
nmap [d <Action>(GotoPreviousError)
let g:WhichKeyDesc_go_to_prev_error1 = '[d Go to previous error'
nmap <C-c>!p <Action>(GotoPreviousError)
" Go to next error
nmap ]d <Action>(GotoNextError)
let g:WhichKeyDesc_go_to_next_error1 = ']d Go to next error'
nmap <C-c>!n <Action>(GotoNextError)
" Go to previous method
nmap [[ <Action>(MethodUp)
let g:WhichKeyDesc_go_to_prev_method = '[[ Go to previous method'
" Go to next method
nmap ]] <Action>(MethodDown)
let g:WhichKeyDesc_go_to_next_method = ']] Go to next method'
"
" +file
let g:WhichKeyDesc_file_leader = '<leader>f +file'
" Open project editorconfig
map <Leader>fc <Action>(NewEditorConfigFile)
let g:WhichKeyDesc_open_project_editorconfig = '<leader>fc Open project editorconfig'
" Find file
map <Leader>ff <Action>(SearchEverywhere)
let g:WhichKeyDesc_find_file2 = '<leader>ff Find file'
" Recent files
map <Leader>fr <Action>(RecentFiles)
let g:WhichKeyDesc_recent_files = '<leader>fr Recent files'
" Save file
noremap <Leader>fs :<C-u>w<CR>
let g:WhichKeyDesc_save_file = '<leader>fs Save file'
" Copy filename
map <Leader>fy <Action>(CopyAbsolutePath)
let g:WhichKeyDesc_copy_filename = '<leader>fy Copy filename'
" Rename/move file
map <Leader>fR <Action>(RefactoringMenu)
let g:WhichKeyDesc_rename_move_file = '<leader>fR Rename/move file'
"
" +git
let g:WhichKeyDesc_git_leader = '<leader>g +git'
" GitHub menu
map <Leader>g' <Action>(GitHub.MainMenu)
let g:WhichKeyDesc_github_menu = "<leader>g' GitHub menu"
" Git file actions
map <Leader>g. <Action>(Git.FileActions)
let g:WhichKeyDesc_git_file_actions = '<leader>g. Git file actions'
" Git menu
map <Leader>g/ <Action>(Git.Menu)
let g:WhichKeyDesc_git_menu = '<leader>g/ Git menu'
" Jump to previous hunk
nmap <Leader>g[ <Action>(VcsShowPrevChangeMarker)
let g:WhichKeyDesc_jump_to_prev_hunk1 = '<leader>g[ Jump to previous hunk'
nmap [c <Action>(VcsShowPrevChangeMarker)
let g:WhichKeyDesc_jump_to_prev_hunk2 = '[c Jump to previous hunk'
" Jump to next hunk
nmap <Leader>g] <Action>(VcsShowNextChangeMarker)
let g:WhichKeyDesc_jump_to_next_hunk1 = '<leader>g] Jump to next hunk'
nmap ]c <Action>(VcsShowNextChangeMarker)
let g:WhichKeyDesc_jump_to_next_hunk2 = ']c Jump to next hunk'
" Switch branch
map <Leader>gb <Action>(Git.Branches)
let g:WhichKeyDesc_switch_branch = '<leader>gb Switch branch'
" Revert hunk
map <Leader>gr <Action>(Vcs.RollbackChangedLines)
let g:WhichKeyDesc_revert_hunk = '<leader>gr Revert hunk'
" Status
map <Leader>gs <Action>(Vcs.Show.Shelf)
let g:WhichKeyDesc_status = '<leader>gs Status'
" Git time machine
map <Leader>gt <Action>(Vcs.ShowTabbedFileHistory)
let g:WhichKeyDesc_git_time_machine = '<leader>gt Time machine'
" Blame
map <Leader>gB <Action>(Annotate)
let g:WhichKeyDesc_blame = '<leader>gB Blame'
" Clone
map <Leader>gC <Action>(Vcs.VcsClone)
let g:WhichKeyDesc_clone1 = '<leader>gC Clone'
" Fetch
map <Leader>gF <Action>(Git.Fetch)
let g:WhichKeyDesc_fetch = '<leader>gF Fetch'
" Git stage file
map <Leader>gS <Action>(Git.Add)
let g:WhichKeyDesc_git_stage_file = '<leader>gS Git stage file'
" +create
let g:WhichKeyDesc_git_create_leader = '<leader>gc +create'
" Branch
map <Leader>gcb <Action>(Git.CreateNewBranch)
let g:WhichKeyDesc_create_branch = '<leader>gcb Branch'
" Pull request
map <Leader>gcp <Action>(Github.Create.Pull.Request)
let g:WhichKeyDesc_create_pr = '<leader>gcp Pull request'
" Initialize repo
map <Leader>gcr <Action>(Git.Init)
let g:WhichKeyDesc_init_repo = '<leader>gcr Initialize repo'
" Clone repo
map <Leader>gcR <Action>(Vcs.VcsClone)
let g:WhichKeyDesc_clone2 = '<leader>gcR Clone repo'
" +list
let g:WhichKeyDesc_list_leader = '<leader>gl +list'
" List pull requests
map <Leader>glp <Action>(Github.View.Pull.Request)
let g:WhichKeyDesc_list_prs = '<leader>glp List pull requests'
" +open
let g:WhichKeyDesc_git_open_leader = '<leader>go +open'
" Browse file or region
map <Leader>goo <Action>(Github.Open.In.Browser)
let g:WhichKeyDesc_browse_file_or_region = '<leader>goo Browse file or region'
" Browse a pull request
map <Leader>gop <Action>(com.github.shiraji.findpullrequest.action.FindPullRequestAction)
let g:WhichKeyDesc_browse_pr = '<leader>gop Browse a pull request'
"
" +help
let g:WhichKeyDesc_help_leader = '<leader>h +help'
" Show Event Log
map <Leader>he <Action>(ActivateEventLogToolWindow)
let g:WhichKeyDesc_event_log = '<leader>he Show Event Log'
" Reload IdeaVim config
map <Leader>hr <Action>(IdeaVim.ReloadVimRc.reload)
let g:WhichKeyDesc_reload_ideavim_config = '<leader>hr Reload IdeaVim config'
" Change theme
map <Leader>ht <Action>(ChangeLaf)
let g:WhichKeyDesc_change_theme = '<leader>ht Change theme'
"
" +insert
let g:WhichKeyDesc_insert_leader = '<leader>i +insert'
" Insert emoji/unicode
nmap <Leader>ie <Action>(EmojiAndSymbols)
imap <A-Space>ie <Action>(EmojiAndSymbols)
let g:WhichKeyDesc_insert_emoji_unicode1 = '<leader>ie Insert emoji/unicode'
" Insert Live Template
nmap <Leader>is <Action>(InsertLiveTemplate)
imap <A-Space>is <Action>(InsertLiveTemplate)
let g:WhichKeyDesc_insert_live_template = '<leader>is Insert Live Template'
" Insert emoji/unicode
nmap <Leader>iu <Action>(EmojiAndSymbols)
imap <A-Space>iu <Action>(EmojiAndSymbols)
let g:WhichKeyDesc_insert_emoji_unicode2 = '<leader>iu Insert emoji/unicode'
" Insert from clipboard
nmap <Leader>iy <Action>(PasteMultiple)
imap <A-Space>iy <Action>(PasteMultiple)
let g:WhichKeyDesc_insert_from_clipboard = '<leader>iy Insert from clipboard'
"
" +open
let g:WhichKeyDesc_open_leader = '<leader>o +open'
" New window
nmap <Leader>of <Action>(EditSourceInNewWindow)
let g:WhichKeyDesc_new_window = '<leader>of New window'
" Select window
nmap <Leader>oF <Action>(OpenProjectWindows)
let g:WhichKeyDesc_select_window = '<leader>oF Select window'
" Toggle Project View
noremap <Leader>op :<C-u>NERDTreeToggle<CR>
let g:WhichKeyDesc_project_sidebar = '<leader>op Toggle Project View'
" Find file in Project View
noremap <Leader>oP :<C-u>NERDTreeFind<CR>
let g:WhichKeyDesc_find_file_in_project_sidebar = '<leader>oP Find file in Project View'
" Reveal in filer
nmap <Leader>oo <Action>(RevealIn)
let g:WhichKeyDesc_reveal_in_filer = '<leader>oo Reveal in filer'
" Open terminal
nmap <Leader>ot <Action>(ActivateTerminalToolWindow)
let g:WhichKeyDesc_open_terminal = '<leader>ot Open terminal'
" Open terminal here
nmap <Leader>oT <Action>(Terminal.OpenInTerminal)
let g:WhichKeyDesc_open_terminal_here = '<leader>oT Open terminal here'
"
" +project
let g:WhichKeyDesc_project_leader = '<leader>p +project'
" Run cmd in project root
map <Leader>p! <Action>(RunAnything)
let g:WhichKeyDesc_run_cmd_in_project_root = '<leader>p! Run cmd in project root'
" Invalidate project cache
map <Leader>pi <Action>(InvalidateCaches)
let g:WhichKeyDesc_invalidate_project_cache = '<leader>pi Invalidate project cache'
" Switch projects
map <Leader>pp <Action>(ManageRecentProjects)
let g:WhichKeyDesc_switch_projects = '<leader>pp Switch projects'
" Show TODO
map <Leader>pt <Action>(ActivateTODOToolWindow)
let g:WhichKeyDesc_show_todo = '<leader>pt Show TODO'
" List project tasks
map <Leader>pz <Action>(RunAnything)
let g:WhichKeyDesc_list_project_tasks = '<leader>pz List project tasks'
" Run project
map <Leader>pR <Action>(Run)
let g:WhichKeyDesc_run_project = '<leader>pR Run project'
"
" +toggle
let g:WhichKeyDesc_toggle_leader = '<leader>t +toggle'
" Presentation Mode
map <Leader>tb <Action>(TogglePresentationMode)
let g:WhichKeyDesc_toggle_presentation_mode = '<leader>tb Presentation Mode'
" Line numbers
map <Leader>tl <Action>(EditorToggleShowLineNumbers)
let g:WhichKeyDesc_toggle_line_numbers = '<leader>tl Line numbers'
" Read-only mode
map <Leader>tr <Action>(ToggleReadOnlyAttribute)
let g:WhichKeyDesc_toggle_readonly_mode = '<leader>tr Read-only mode'
" Soft line wrapping
map <Leader>tw <Action>(EditorToggleUseSoftWraps)
let g:WhichKeyDesc_toggle_soft_line_wrapping = '<leader>tw Soft line wrapping'
" Distraction Free Mode
map <Leader>tz <Action>(ToggleDistractionFreeMode)
let g:WhichKeyDesc_toggle_distraction_free_mode = '<leader>tz Distraction Free Mode'
" Zen Mode
map <Leader>tZ <Action>(ToggleZenMode)
let g:WhichKeyDesc_toggle_zen_mode = '<leader>tZ Zen Mode'
" Fullscreen
map <Leader>tF <Action>(ToggleFullScreen)
let g:WhichKeyDesc_toggle_fullscreen = '<leader>tF Fullscreen'
"
" +search
let g:WhichKeyDesc_search_leader = '<leader>s +search'
" Search project
map <Leader>sp <Action>(FindInPath)
let g:WhichKeyDesc_search_project2 = '<leader>sp Search project'
" Look up in Dash docsets
map <Leader>sk <Action>(SmartSearchAction)
let g:WhichKeyDesc_look_up_in_docsets = '<leader>sk Look up in Dash docsets'
"
" +window
" Show error description
nmap <C-w>d <Action>(ShowErrorDescription)
let g:WhichKeyDesc_show_error_description1 = '<C-w>d Show error description'
nmap <C-w><C-d> <Action>(ShowErrorDescription)
let g:WhichKeyDesc_show_error_description2 = '<C-w><C-d> Show error description'
noremap <Leader>wc <C-w>c
noremap <Leader>wd <C-w>c
noremap <Leader>wh <C-w>h
noremap <Leader>wj <C-w>j
noremap <Leader>wk <C-w>k
noremap <Leader>wl <C-w>l
noremap <Leader>ws <C-w>s
noremap <Leader>wv <C-w>v
noremap <Leader>ww <C-w>w
noremap <Leader>wW <C-w>W
noremap <Leader>wq <C-w>c
" Maximize window
noremap <Leader>wm <Action>(Unsplit)
let g:WhichKeyDesc_window_leader = '<leader>w +window'
"
" Emulated plugins
" argtextobj
let g:argtextobj_pairs = '(:),{:},[:]'
set argtextobj
" easymotion
let g:EasyMotion_do_mapping = 0
let g:EasyMotion_startofline = 0
set easymotion
unmap <Leader><Space>
map gsb <Plug>(easymotion-bl)
map gse <Plug>(easymotion-el)
map gsf <Plug>(easymotion-f)
map gsF <Plug>(easymotion-F)
map gsj <Plug>(easymotion-j)
map gsk <Plug>(easymotion-k)
map gsn <Plug>(easymotion-n)
map gsN <Plug>(easymotion-N)
map gss <Plug>(easymotion-s2)
map gst <Plug>(easymotion-t)
map gsT <Plug>(easymotion-T)
map gsw <Plug>(easymotion-wl)
map gsge <Plug>(easymotion-gel)
" highlightedyank
set highlightedyank
" NERDTree
let g:NERDTreeMapActivateNode = 'l'
let g:NERDTreeMapPreview = '<Nop>'
let g:NERDTreeMapOpenInTab = 'oo'
let g:NERDTreeMapOpenInTabSilent = '<Nop>'
let g:NERDTreeMapOpenSplit = 'ov'
let g:NERDTreeMapPreviewSplit = '<Nop>'
let g:NERDTreeMapOpenVSplit = 'os'
let g:NERDTreeMapPreviewVSplit = '<Nop>'
let g:NERDTreeMapOpenRecursively = '<Nop>'
let g:NERDTreeMapCloseDir = 'h'
let g:NERDTreeMapCloseChildren = '<Nop>'
let g:NERDTreeMapJumpRoot = '<Nop>'
let g:NERDTreeMapJumpParent = 'K'
let g:NERDTreeMapJumpFirstChild = '<Nop>'
let g:NERDTreeMapJumpLastChild = '<Nop>'
let g:NERDTreeMapJumpNextSibling = 'L'
let g:NERDTreeMapJumpPrevSibling = 'H'
let g:NERDTreeMapRefresh = '<Nop>'
let g:NERDTreeMapRefreshRoot = 'gr'
let g:NERDTreeMapMenu = '<Nop>'
" let g:NERDTreeMapQuit = 'q'
let g:NERDTreeMapToggleZoom = '<Nop>'
set NERDTree
" vim-which-key
let g:WhichKey_DefaultDelay = 1000
let g:WhichKey_ShowVimActions = 'true'
set notimeout
set which-key