forked from exvim/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
460 lines (396 loc) · 13.5 KB
/
.ideavimrc
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
let mapleader=','
""" Plugins --------------------------------
set surround
" set multiple-cursors
" set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
set NERDTree
set exchange
set textobj-indent
" set matchit
" set which-key
""" Idea specific settings ------------------
" set ideamarks
" set ideavimsupport=dialog,singleline
""" vim settings ------------------
set hlsearch
set incsearch
" 搜索时智能匹配大小写
set ignorecase
set smartcase
set showmode
" set number
set relativenumber
set scrolloff=3
set history=100000
set clipboard=unnamed,unnamedplus
" Enable native idea paste action for put operations
set clipboard+=ideaput
" disable the timeout option
set notimeout
"set timeoutlen=5000
set visualbell
" set noerrorbells
nnoremap ; :
vnoremap ; :
" nnoremap <Leader>h *
" noremap <Leader>h :action HighlightUsagesInFile<CR>
map <Leader>h *N
" noremap <Leader>h "/yiw:set hls<CR>
nmap <Leader>n *
nmap <Leader>N #
nmap grr griw
"visual 模式 下 按* 号 搜索 光标选中的内容(对已选中的内容进行查找)
vmap * "ry/<C-R>r<CR>
map <C-O> <Action>(Back)
map <C-I> <Action>(Forward)
map g; <Action>(JumpToLastChange)
map g, <Action>(JumpToNextChange)
" but preserve ideavim defaults
nnoremap g<c-o> <c-o>
nnoremap g<c-i> <c-i>
nnoremap > >>_
nnoremap < <<_
" enhance '<' '>' , do not need to reselect the block after shift it.
vnoremap < <gv
vnoremap > >gv
map == <Action>(ReformatCode)
"vim 的 R 好像 一点 都没用呀…… 替换 之 ……
noremap R :action HideAllWindows<CR>
" enter newlines
" nnoremap <CR> :action EditorEnter<CR>
" inoremap <CR> <C-o>:action EditorEnter<CR>
noremap <CR> :action EditorSelectWord<CR>
" previous/next
noremap [[ <ESC>:action MethodUp<CR>
noremap ]] <ESC>:action MethodDown<CR>
nnoremap [m :action MethodUp<CR>
nnoremap ]m :action MethodDown<CR>
nnoremap [c :action VcsShowPrevChangeMarker<CR>
nnoremap ]c :action VcsShowNextChangeMarker<CR>
nnoremap [e :<C-u>action GotoPreviousError<CR>
nnoremap ]e :<C-u>action GotoNextError<CR>
nnoremap [<space> O<esc>j
nnoremap ]<space> o<esc>k
nnoremap [q :action PreviousOccurence<cr>
nnoremap ]q :action NextOccurence<cr>
nnoremap ]n :action FindNext<cr>
nnoremap [n :action FindPrevious<cr>
nnoremap ]p :action NextParameter<cr>
nnoremap [p :action PrevParameter<cr>
" 切换前后buffer
nnoremap [b :bprevious<cr>
nnoremap ]b :bnext<cr>
nnoremap <C-C> <Esc>
" g
nnoremap ga :action GotoAction<CR>
nnoremap gd :action GotoDeclaration<CR>
nnoremap gf :action GotoFile<CR>
nnoremap gi :action GotoImplementation<CR>
nnoremap gs :action GotoSymbol<CR>
" easymotion
nmap t <Plug>(easymotion-prefix)
nmap tt <Plug>(easymotion-sn)
nmap tj <Plug>(easymotion-j)
nmap tk <Plug>(easymotion-k)
nmap tl <Plug>(easymotion-lineforward)
nmap th <Plug>(easymotion-linebackward)
" nmap t. <Plug>(easymotion-repeat)
vmap t <Plug>(easymotion-prefix)
vmap tt <Plug>(easymotion-sn)
vmap tj <Plug>(easymotion-j)
vmap tk <Plug>(easymotion-k)
vmap tl <Plug>(easymotion-lineforward)
vmap th <Plug>(easymotion-linebackward)
" vmap t. <Plug>(easymotion-repeat)
nmap f <Plug>(easymotion-lineforward)
nmap F <Plug>(easymotion-linebackward)
vmap f <Plug>(easymotion-lineforward)
vmap F <Plug>(easymotion-linebackward)
" 代码折叠自定义快捷键
nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zO :action ExpandRegionRecursively<CR>
nmap <Space> <C-e>
nmap <S-Space> <C-y>
" Quit visual mode
vnoremap v <Esc>
" Move to the start of line
nnoremap H ^
" Move to the end of line
nnoremap L $
" Redo
nnoremap U <C-r>
" Yank to the end of line
nnoremap Y y$
" Window operation
nnoremap <Leader>ww <C-W>w
nnoremap <Leader>wd <C-W>c
nnoremap <Leader>wj <C-W>j
nnoremap <Leader>wk <C-W>k
nnoremap <Leader>wh <C-W>h
nnoremap <Leader>wl <C-W>l
nnoremap <Leader>ws <C-W>s
nnoremap <Leader>w- <C-W>s
nnoremap <Leader>wv <C-W>v
nnoremap <Leader>w\| <C-W>v
nnoremap <Leader>wt :action ActivateTerminalToolWindow<CR>
nnoremap <Leader>wu :action Unsplit<CR>
nnoremap <Leader>wx :action HideAllWindows<CR>
nnoremap <Leader>wz :action ToggleDistractionFreeMode<CR>
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l
"nnoremap <C-w>o :<C-u>action CloseAllEditorsButActive<CR>
nnoremap gwm :action ActivateEventLogToolWindow<CR>
nnoremap gwg :action ActivateGradleToolWindow<CR>
nnoremap gwd :action ActivateDebugToolWindow<CR>
nnoremap gwr :action ActivateRunToolWindow<CR>
nnoremap gwb :action ViewBreakpoints<CR>
nnoremap gwp :action ActivateProjectToolWindow<CR>
nnoremap gwf :action ActivateFindToolWindow<CR>
nnoremap <Leader>gs :action ActivateFindToolWindow<CR>
nnoremap <Leader>gi :action ActivateFindToolWindow<CR>
nnoremap gwh :action StretchSplitToLeft<CR>
nnoremap gwl :action StretchSplitToRight<CR>
nnoremap gwk :action StretchSplitToDown<CR>
nnoremap gwj :action StretchSplitToTop<CR>
nnoremap gww :action ChangeSplitOrientation<CR>
nmap <Leader>t1 <Action>(GoToTab1)
nmap <Leader>t2 <Action>(GoToTab2)
nmap <Leader>t3 <Action>(GoToTab3)
nmap <Leader>t4 <Action>(GoToTab4)
nmap <Leader>t5 <Action>(GoToTab5)
nmap <Leader>t6 <Action>(GoToTab6)
nmap <Leader>t7 <Action>(GoToTab7)
nmap <Leader>t8 <Action>(GoToTab8)
nmap <Leader>t9 <Action>(GoToTab9)
" search
nnoremap <Leader>ps viw:action SearchEverywhere<CR><ESC>
vnoremap <Leader>ps :action SearchEverywhere<CR>
nnoremap <Leader>pf viw:action FindInPath<CR><ESC>
vnoremap <Leader>pf :action FindInPath<CR>
noremap <Leader>pt :action FindInPath<CR>
noremap <Leader>po :action OptimizeImports<CR>
noremap <Leader>pm :action ShowPopupMenu<CR>
nnoremap <Leader>fb :action RecentFiles<CR>
nnoremap <Leader>ff viw:action GotoFile<CR><ESC>
vnoremap <Leader>ff :action GotoFile<CR>
nnoremap <Leader>fm :action FileStructurePopup<CR>
nnoremap <Leader>fu :action FindUsages<CR>
" nnoremap <Leader>fp :action ShowFilePath<CR>
nnoremap <Leader>fp viw:action FindInPath<CR><ESC>
vnoremap <Leader>fp :action FindInPath<CR>
noremap <Leader>ft :action FindInPath<CR>
noremap <Leader>fw :action Find<CR>
noremap <Leader>fc :action GotoClass<CR>
" 弹出切换tab
noremap <Leader>fs :action Switcher<CR>
noremap <Leader>o viw:action GotoFile<CR><ESC>
noremap <Leader>j :action FindUsages<CR>
noremap <C-p> :action GotoFile<CR>
noremap <C-S-p> :action GotoClass<CR>
" file
nnoremap <C-s> :w<CR>
" Tab operation
nnoremap <Leader>tn gt
nnoremap <Leader>tp gT
nnoremap <Leader>tc :action CloseContent<CR>
" Terminal
nnoremap <Leader>tl Vy<CR>:action ActivateTerminalToolWindow<CR>
vnoremap <Leader>tl y<CR>:action ActivateTerminalToolWindow<CR>
"=== 翻译软件
map <Leader>ts <Action>(ShowTranslationDialogAction)
" nmap tt <Action>(ActivateProjectToolWindow)
map <Leader>tw <Action>(EditorTranslateAction)
" ==================================================
" Show all the provided actions via `:actionlist`
" ==================================================
" clear the highlighted search result
noremap <Leader>/ :set nohlsearch<CR>
noremap gcc :action CommentByLineComment<CR>
noremap gcb :action CommentByBlockComment<CR>
map <Leader>cl gcc
map <Leader>ci gcc
nnoremap <Leader>bb :action ToggleLineBreakpoint<CR>
nnoremap <Leader>br :action ViewBreakpoints<CR>
nnoremap <Leader>bp :bprevious<CR>
nnoremap <Leader>bn :bnext<CR>
nnoremap <Leader>cv :action ChangeView<CR>
nnoremap <Leader>cd :action ChooseDebugConfiguration<CR>
"=== 打断点
" debug运行
nmap <Leader>dr <Action>(Debug)
" debug运行当前类
nmap <Leader>dc <Action>(DebugClass)
nmap <Leader>db <Action>(ToggleLineBreakpoint)
" debug调试
nmap <Leader>dn <Action>(StepOver)
nmap <Leader>di <Action>(StepInto)
nmap <Leader>do <Action>(StepOut)
nmap <Leader>ds <Action>(Stop)
" 显示所有断点信息
nmap <Leader>dm <Action>(ViewBreakpoints)
" extract actions
nnoremap <Leader>ei :action ExtractInterface<CR>
nnoremap <Leader>es :action ExtractSuperclass<CR>
nnoremap <Leader>en :action ExtractClass<CR>
nnoremap <Leader>em :action ExtractMethod<CR>
vnoremap <Leader>em <Esc>gvhh:<bs><bs><bs><bs><bs>action VimVisualSwapSelections<cr>:action ExtractMethod<CR>
nnoremap <Leader>ev :action IntroduceVariable<CR>
vnoremap <Leader>ev <Esc>gvhh:<bs><bs><bs><bs><bs>action VimVisualSwapSelections<cr>:action IntroduceVariable<CR>
nnoremap <Leader>ef :action IntroduceField<CR>
vnoremap <Leader>ef <Esc>gvhh:<bs><bs><bs><bs><bs>action VimVisualSwapSelections<cr>:action IntroduceField<CR>
nnoremap <Leader>ep :action IntroduceParameter<CR>
vnoremap <Leader>ep <Esc>gvhh:<bs><bs><bs><bs><bs>action VimVisualSwapSelections<cr>:action IntroduceParameter<CR>
nnoremap <Leader>ec :action IntroduceConstant<CR>
vnoremap <Leader>ec <Esc>gvhh:<bs><bs><bs><bs><bs>action VimVisualSwapSelections<cr>:action IntroduceConstant<CR>
" error
nnoremap <Leader>ee :action ShowErrorDescription<CR>
" version control actions
nnoremap <Leader>vu :action Vcs.UpdateProject<CR>
nnoremap <Leader>vp :action Vcs.Push<CR>
nnoremap <Leader>vc :action Vcs.QuickListPopupAction<CR>
nnoremap <Leader>vb :action Git.Branches<CR>
nnoremap <Leader>vv :action ActivateVersionControlToolWindow<CR>
nnoremap <Leader>va :action Annotate<CR>
nnoremap <Leader>vl :action Vcs.Show.Log<CR>
nnoremap <Leader>vm :action Vcs.QuickListPopupAction<CR>
nnoremap <Leader>vc :action CheckinProject<CR>
nnoremap <Leader>vd :action Compare.SameVersion<CR>
nnoremap <Leader>vr :action ChangesView.Revert<CR>
nnoremap <Leader>vh :action Vcs.ShowTabbedFileHistory<CR>
" Language actions
nnoremap <Leader>lb :action ToggleLineBreakpoint<CR>
nnoremap <Leader>l/ :action CommentByLineComment<CR>
nnoremap <Leader>lrp :action Refactorings.QuickListPopupAction<CR>
nnoremap <Leader>lr= :action ReformatCode<CR>
nnoremap <Leader>ld :action GotoDeclaration<CR>
nnoremap <Leader>lpd :action QuickDeclaration<CR>
nnoremap <Leader>li :action GotoImplementation<CR>
nnoremap <Leader>lpi :action QuickImplementation<CR>
nnoremap <Leader>lu :action FindUsages<CR>
nnoremap <Leader>ll :action RecentLocations<CR>
nnoremap <Leader>ltr :action RiderUnitTestRunContextAction<CR>
nnoremap <Leader>i :action HighlightUsagesInFile<CR>
" nnoremap <Leader>ic :action InspectCode<CR>
nnoremap <Leader>rc :action RunToCursor<CR>
nnoremap <Leader>rC :action ChooseRunConfiguration<CR>
nnoremap <Leader>re :action RenameElement<CR>
nnoremap <Leader>rf :action RenameFile<CR>
nnoremap <Leader>rr :action Rerun<CR>
" refactoring actions
nnoremap <Leader>ri :action Inline<CR>
nnoremap <Leader>rr :action RenameElement<CR>i
nnoremap <Leader>rj :action MemberPushDown<CR>
nnoremap <Leader>rk :action MemberPullUp<CR>
nnoremap <Leader>rs :action ChangeSignature<CR>
nnoremap <Leader>rd :action SafeDelete<CR>
nnoremap <Leader>rm :action Move<CR>
nnoremap <Leader>se :action SearchEverywhere<CR>
nnoremap <Leader>ss viw:action GotoSymbol<CR><ESC>
vnoremap <Leader>ss :action GotoSymbol<CR>
nnoremap <Leader>st :action GotoSymbol<CR>
nnoremap <Leader>su :action ShowUsages<CR>
nnoremap <Leader>so :source ~/.ideavimrc<CR>
" help
nnoremap <Leader>? :action GotoAction<CR>
" Quit normal mode
nnoremap <Leader>q :q<CR>
nnoremap <Leader>Q :qa!<CR>
" quit ==> close current window
nnoremap <Leader>q <C-W>w
nmap <Leader>yf <Action>(CopyPaths)
nmap <Leader>yn <Action>(CopyReference)
nnoremap <Leader>fx :NERDTreeFind<CR>
" nnoremap <Leader>nn :NERDTreeFocus<CR>
nnoremap <Leader>x :NERDTreeToggle<CR>
" Insert mode shortcut
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <Delete>
" Quit insert mode
" inoremap jj <Esc>
" inoremap jk <Esc>
" inoremap kk <Esc>
" Command
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-d> <Del>
cnoremap <C-n> <Down>
cnoremap <C-p> <Up>
"===
"=== 书签管理
"===
nmap mm <Action>(ToggleBookmark)
" 显示所书签
nmap ma <Action>(ShowBookmarks)
" 编辑书签
nmap m; <Action>(Bookmarks)
nmap 'a <Action>(GotoBookmarkA)
nmap 'b <Action>(GotoBookmarkB)
nmap 'c <Action>(GotoBookmarkC)
nmap 'd <Action>(GotoBookmarkD)
nmap 'e <Action>(GotoBookmarkE)
nmap 'f <Action>(GotoBookmarkF)
nmap 'g <Action>(GotoBookmarkG)
nmap 'h <Action>(GotoBookmarkH)
nmap 'i <Action>(GotoBookmarkI)
nmap 'j <Action>(GotoBookmarkJ)
nmap 'k <Action>(GotoBookmarkK)
nmap 'l <Action>(GotoBookmarkL)
nmap 'm <Action>(GotoBookmarkM)
nmap 'n <Action>(GotoBookmarkN)
nmap 'o <Action>(GotoBookmarkO)
nmap 'p <Action>(GotoBookmarkP)
nmap 'q <Action>(GotoBookmarkQ)
nmap 'r <Action>(GotoBookmarkR)
nmap 's <Action>(GotoBookmarkS)
nmap 't <Action>(GotoBookmarkT)
nmap 'u <Action>(GotoBookmarkU)
nmap 'v <Action>(GotoBookmarkV)
nmap 'w <Action>(GotoBookmarkW)
nmap 'x <Action>(GotoBookmarkX)
nmap 'y <Action>(GotoBookmarkY)
nmap 'z <Action>(GotoBookmarkZ)
"nmap ma <Action>(ToggleBookmarkA)
nmap mb <Action>(ToggleBookmarkB)
nmap mc <Action>(ToggleBookmarkC)
nmap md <Action>(ToggleBookmarkD)
nmap me <Action>(ToggleBookmarkE)
nmap mf <Action>(ToggleBookmarkF)
nmap mg <Action>(ToggleBookmarkG)
nmap mh <Action>(ToggleBookmarkH)
nmap mi <Action>(ToggleBookmarkI)
nmap mj <Action>(ToggleBookmarkJ)
nmap mk <Action>(ToggleBookmarkK)
nmap ml <Action>(ToggleBookmarkL)
"nmap mm <Action>(ToggleBookmarkM)
nmap mn <Action>(ToggleBookmarkN)
nmap mo <Action>(ToggleBookmarkO)
nmap mp <Action>(ToggleBookmarkP)
nmap mq <Action>(ToggleBookmarkQ)
nmap mr <Action>(ToggleBookmarkR)
nmap ms <Action>(ToggleBookmarkS)
nmap mt <Action>(ToggleBookmarkT)
nmap mu <Action>(ToggleBookmarkU)
nmap mv <Action>(ToggleBookmarkV)
nmap mw <Action>(ToggleBookmarkW)
nmap mx <Action>(ToggleBookmarkX)
nmap my <Action>(ToggleBookmarkY)
nmap mz <Action>(ToggleBookmarkZ)
" Plugins to also install:
" 1. IdeaVim
" 2. AceJump
" 3. IdeaVim-EasyMotion
" 4. Rainbow Brackets
" 5. Solarized Themes