-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
314 lines (281 loc) · 11.3 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
"" Source your .vimrc
"source ~/.vimrc
set NERDTree
set ReplaceWithRegister " gr, grr
set argtextobj " aa, ia
set commentary " gcc, gc + motion, v_gc
set highlightedyank
set ideajoin
set ideamarks
set ideastatusicon=gray
set surround " ys, cs, ds, S
set textobj-entire " ae, ie
set visualbell
set noerrorbells
set autoindent
set clipboard+=ideaput
set clipboard+=unnamedplus
set ignorecase
set incsearch
set number relativenumber
set scrolloff=8
set showcmd
set showmode
set smartindent
set smarttab
set which-key
set notimeout
" better mapping for search
nnoremap / :action Find<CR>
nnoremap <C-n> :action FindNext<CR>
nnoremap <C-p> :action FindPrevious<CR>
let g:WhichKey_FontSize = 15
let g:WhichKey_CommandColor = "#8caaee"
let g:WhichKey_PrefixColor = "#ca9ee6"
let g:WhichKey_KeyColor = "#c6d0f5"
let g:WhichKey_SortOrder = "by_key_prefix_first"
let g:WhichKey_FontFamily = "JetBrains Mono Medium"
let g:WhichKey_Divider = " "
let g:WhichKey_ShowVimActions = "true"
" Open ideavimrc
map <leader>; :vsplit ~/.ideavimrc<CR>
let g:WhichKeyDesc_leader_vimrc = "<leader>; open ideavimrc"
let g:WhichKeyDesc_replace = "gr replace with register"
let g:WhichKeyDesc_comment = "gcc comment line"
let g:WhichKeyDesc_comment = "gc"
" use space as leader
map <Space> <leader>
" use ;; for escape
inoremap jj <Esc>
"disable key movement in normal, visual, select, and operator-pending modes
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
"move lines up and down and adjust indent
nnoremap <A-k> :m .-2<CR>==
nnoremap <A-j> :m .+1<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
"delete single character without copying into register
nnoremap x "_x
"remap Y to map from current position to the end of line
"This mapping sets up Y to be consistent with the C and D operators, which act from the cursor to the end of the line
nnoremap Y y$
" copy method or json object
nnoremap YY va{Vy}
" increment and decrement number
" nnoremap <leader>+ <C-a>
" nnoremap <leader>- <C-x>
" window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"map <C-n> <Action>(PopupMenu-selectnext)
"map <C-p> <Action>(PopupMenu-selectprev)
"map <A-n> <Action>(Tree-selectNext)
"map <A-p> <Action>(Tree-selectPrevious)
"inoremap <A-n> <Action>(PopupMenu-selectNext)
"inoremap <A-p> <Action>(PopupMenu-selectPrev)
" \n open and focus NERDTree on current open file
map <leader>e :NERDTreeFind<CR>
let g:WhichKeyDesc_leader_explorer = "<leader>e open file in File Explorer"
"map <leader>s <Action>(Switcher)
map ]t <Action>(NextTab)
map [t <Action>(PreviousTab)
" Debug (d)
" TODO add
map <leader>dt <Action>(ToggleLineBreakpoint)
" step back
" continue
" disconnect
" watch
" expression
" step into
" step out
" quit
" start
" toggle UI
let g:WhichKeyDesc_leader_debug = "<leader>d +Debug"
let g:WhichKeyDesc_debug_breakpoint = "<leader>dt toggle Breakpoint"
" Quit (q) close
map <leader>q <Action>(CloseEditor)
let g:WhichKeyDesc_leader_quit = "<leader>q quit tab"
" Test (t)
map gt <Action>(GotoTest)
map <leader>tr <Action>(RunClass)
map <leader>td <Action>(DebugClass)
map <leader>tc <Action>(RunCoverage)
map <leader>tf <Action>(RerunFailedTests)
map <leader>ta <Action>(RunTestGroup)
map <leader>tt <Action>(TestTreePopupMenu)
let g:WhichKeyDesc_leader_test = "<leader>t +Test"
let g:WhichKeyDesc_test_run = "<leader>tr run nearest test"
let g:WhichKeyDesc_test_debug = "<leader>td debug nearest test"
let g:WhichKeyDesc_test_coverage = "<leader>tc run code coverage"
let g:WhichKeyDesc_test_failed = "<leader>tf rerun failed tests"
let g:WhichKeyDesc_test_all = "<leader>ta run all"
let g:WhichKeyDesc_test_popup = "<leader>tt show test menu"
let g:WhichKeyDesc_test_goto = "gt go to Test"
if has('ide')
if &ide =~? 'Android Studio'
" Android (a)
map <leader>ar <Action>(Run)
map <leader>as <Action>(Stop)
map <leader>ag <Action>(Android.SyncProject)
map <leader>ad <Action>(AndroidConnectDebuggerAction)
map <leader>aa <Action>(com.developerphil.adbidea.action.AdbIdeaQuickList)
map <leader>ae <Action>(Android.DeviceManager2)
map <leader>ac <Action>(ChooseRunConfiguration)
" select device
" device explorer
" configuration
" studio bot
let g:WhichKeyDesc_leader_android = "<leader>a +Android"
let g:WhichKeyDesc_android_run = "<leader>ar run"
let g:WhichKeyDesc_android_stop = "<leader>as stop"
let g:WhichKeyDesc_android_gradleSync = "<leader>ag gradle sync"
let g:WhichKeyDesc_android_debugger = "<leader>ad attach debugger"
let g:WhichKeyDesc_android_adb = "<leader>aa ADB actions"
let g:WhichKeyDesc_android_devices = "<leader>ae Device Explorer"
let g:WhichKeyDesc_android_configuration = "<leader>ac run/debug configurations"
endif
endif
" Split (s)
map <leader>sl <Action>(MoveTabRight)
map <leader>sh <Action>(MoveTabLeft)
map <leader>sj <Action>(MoveTabDown)
map <leader>sk <Action>(MoveTabUp)
map <leader>su <Action>(Unsplit)
let g:WhichKeyDesc_leader_split = "<leader>s +Split"
let g:WhichKeyDesc_split_right = "<leader>sl split and move right"
let g:WhichKeyDesc_split_left = "<leader>sh split and move left"
let g:WhichKeyDesc_split_down = "<leader>sj split and move down"
let g:WhichKeyDesc_split_up = "<leader>sk split and move up"
let g:WhichKeyDesc_split_unsplit = "<leader>su unsplit"
" Find (f)
map <leader>ff <Action>(GotoFile)
map <leader>fs <Action>(FindInPath)
map <leader>fu <Action>(FindUsages)
map <leader>fo <Action>(RecentFiles)
map <leader>fe <Action>(SearchEverywhere)
map <leader>fa <Action>(GotoAction)
map <leader>fl <Action>(RecentLocations)
map <leader>fm <Action>(ShowBookmarks)
let g:WhichKeyDesc_leader_finder = "<leader>f +Find"
let g:WhichKeyDesc_finder_file = "<leader>ff Find file (Name)"
let g:WhichKeyDesc_finder_string = "<leader>fs Find string"
let g:WhichKeyDesc_finder_usage = "<leader>fu Find usage"
let g:WhichKeyDesc_finder_recent = "<leader>fo old files"
let g:WhichKeyDesc_finder_everywhere = "<leader>fe everywhere"
let g:WhichKeyDesc_finder_action = "<leader>fa action"
let g:WhichKeyDesc_finder_location = "<leader>fl recent location"
let g:WhichKeyDesc_finder_marks = "<leader>fm Find Marks"
" Views (v)
map <leader>vb <Action>(ActivateBuildToolWindow)
map <leader>vc <Action>(ActivateCommitToolWindow)
map <leader>vd <Action>(ActivateDebugToolWindow)
map <leader>ve <Action>(ActivateDeviceExplorerToolWindow)
map <leader>vg <Action>(ActivateVersionControlToolWindow)
map <leader>vl <Action>(ActivateLogcatToolWindow)
map <leader>vm <Action>(ActivateBookmarksToolWindow)
map <leader>vo <Action>(ActivateTODOToolWindow)
map <leader>vp <Action>(ActivateProblemsViewToolWindow)
map <leader>vr <Action>(ActivateRunningDevicesToolWindow)
map <leader>vs <Action>(ActivateStructureToolWindow)
map <leader>vt <Action>(ActivateTerminalToolWindow)
"map <leader> <Action>(ActivatePullRequestsToolWindow)
map <leader>vz <Action>(ToggleZenMode)
let g:WhichKeyDesc_leader_view = "<leader>v +View"
let g:WhichKeyDesc_view_build = "<leader>vb BUILD view"
let g:WhichKeyDesc_view_commit = "<leader>vc COMMIT view"
let g:WhichKeyDesc_view_debug = "<leader>vd DEBUG view"
let g:WhichKeyDesc_view_explorer = "<leader>ve device EXPLORER view"
let g:WhichKeyDesc_view_git = "<leader>vg GIT view"
let g:WhichKeyDesc_view_logcat = "<leader>vl LOGCAT view"
let g:WhichKeyDesc_view_marks = "<leader>vm BOOKMARKS (marks) view"
let g:WhichKeyDesc_view_problems = "<leader>vp PROBLEMS view"
let g:WhichKeyDesc_view_running_devices = "<leader>vr running devcies view"
let g:WhichKeyDesc_view_structure = "<leader>vs STRUCTURE view"
let g:WhichKeyDesc_view_terminal = "<leader>vt TERMINAL view"
let g:WhichKeyDesc_view_todo = "<leader>vo TODO view"
let g:WhichKeyDesc_view_zen = "<leader>vz toggle Zen mode"
" Code Lsp (c)
map <leader>ca <Action>(ShowIntentionActions)
map <leader>cd <Action>(ActivateProblemsViewToolWindow)
map <leader>cf <Action>(ReformatCode)
map <leader>cg <Action>(Generate)
map <leader>cd <Action>(ShowErrorDescription)
map <leader>cr <Action>(RenameElement)
map <leader>cu <Action>(FindUsages)
map <leader>co <Action>(OptimizeImports)
map <leader>cR <Action>(Refactorings.QuickListPopupAction)
map ]d <Action>(GotoNextError)
map [d <Action>(GotoPreviousError)
map gl <Action>(ShowErrorDescription)
map gr <Action>(FindUsages)
let g:WhichKeyDesc_leader_lsp = "<leader>c +code"
let g:WhichKeyDesc_lsp_action = "<leader>ca code action"
let g:WhichKeyDesc_lsp_diagnostic = "<leader>cd problems file (diagnostics)"
let g:WhichKeyDesc_lsp_format = "<leader>cf format"
"let g:WhichKeyDesc_lsp_previewDiagnostic = "<leader>lk prev diagnostic"
let g:WhichKeyDesc_lsp_rename = "<leader>cr rename"
let g:WhichKeyDesc_lsp_usage = "<leader>cu usage"
let g:WhichKeyDesc_lsp_imports = "<leader>co optimize imports"
let g:WhichKeyDesc_lsp_quicklist = "<leader>cR Refactoring options"
let g:WhichKeyDesc_lsp_error = "gl show error description"
let g:WhichKeyDesc_lsp_references = "gr show references"
" Marks (m)
map <leader>mt <Action>(ToggleBookmark)
map <leader>mm <Action>(ToggleBookmarkWithMnemonic)
map <leader>me <Action>(EditBookmark)
map <leader>ml <Action>(ShowTypeBookmarks)
map <leader>mp <Action>(ShowBookmarks)
map gm <Action>(ShowTypeBookmarks)
map g1 <Action>(GotoBookmark1)
map g2 <Action>(GotoBookmark2)
map g3 <Action>(GotoBookmark3)
map g4 <Action>(GotoBookmark4)
map g5 <Action>(GotoBookmark5)
let g:WhichKeyDesc_leader_marks = "<leader>m +Marks (Bookmarks)"
let g:WhichKeyDesc_marks_toggle = "<leader>mt toggle mark"
let g:WhichKeyDesc_marks_mmnemonic = "<leader>mm toggle Mnemonic mark"
let g:WhichKeyDesc_marks_edit = "<leader>me edit name"
let g:WhichKeyDesc_marks_list = "<leader>ml mnemonic list"
let g:WhichKeyDesc_marks_preview = "<leader>mp preview all marks"
let g:WhichKeyDesc_marks_show = "gm go to mnemonic marks (show marks)"
let g:WhichKeyDesc_marks_goto1 = "g1 go to mark 1"
let g:WhichKeyDesc_marks_goto2 = "g2 go to mark 2"
let g:WhichKeyDesc_marks_goto3 = "g3 go to mark 3"
let g:WhichKeyDesc_marks_goto4 = "g4 go to mark 4"
let g:WhichKeyDesc_marks_goto5 = "g5 go to mark 5"
" Git (g)
map <leader>gn <Action>(Git.CreateNewBranch)
map <leader>ga <Action>(Git.Branches)
map <leader>gb <Action>(GitToolBox.SwitchRecentBranches)
map <leader>gj <Action>(VcsShowNextChangeMarker)
map <leader>gk <Action>(VcsShowPrevChangeMarker)
map <leader>gd <Action>(Compare.LastVersion)
map <leader>gr <Action>(Vcs.RollbackChangedLines)
map <leader>gc <Action>(ActivateCommitToolWindow)
map <leader>gl <Action>(Annotate)
map <leader>gp <Action>(Vcs.UpdateProject)
map [h <Action>(VcsShowPrevChangeMarker)
map ]h <Action>(VcsShowNextChangeMarker)
let g:WhichKeyDesc_leader_git = "<leader>g +Git"
let g:WhichKeyDesc_git_new = "<leader>gn new branch"
let g:WhichKeyDesc_git_action = "<leader>ga action panel"
let g:WhichKeyDesc_git_branch = "<leader>gb switch branch"
let g:WhichKeyDesc_git_nextHunk = "<leader>gj next hunk"
let g:WhichKeyDesc_git_prevHunk = "<leader>gk prev hunk"
let g:WhichKeyDesc_git_diff = "<leader>gd diff"
let g:WhichKeyDesc_git_rollback = "<leader>gr rollback"
let g:WhichKeyDesc_git_commit = "<leader>gc commit"
let g:WhichKeyDesc_git_blame = "<leader>gl blame"
let g:WhichKeyDesc_git_update = "<leader>gp pull (update project)"
" Find more examples here: https://jb.gg/share-ideavimrc
" find actions in :actionlist
" track actions by turning on 'IdeaVim: track action Ids' in settings