-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.ideavimrc
464 lines (426 loc) · 12.8 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
461
462
463
" LazyVim key mappings for Jetbrains IDEs.
" LazyVim default settings
" https://www.lazyvim.org/configuration/general
let mapleader=" "
let maplocalleader="\\"
" Confirm to save changes before exiting modified buffer
set formatoptions=jcroqlnt
" Print line number
set number
" Relative line numbers
set relativenumber
" Lines of context
set scrolloff=4
" Round indent
set shiftround
" Columns of context
set sidescrolloff=8
" which-key says to set this high, or set notimeout
set timeoutlen=10000
set notimeout
set undolevels=10000
" Disable line wrap
set nowrap
" Neovim settings that differ from Vim
" https://neovim.io/doc/user/diff.html
" https://github.com/mikeslattery/nvim-defaults.vim/blob/main/plugin/.vimrc
set backspace=indent,eol,start
set formatoptions=tcqj
set listchars=tab:>\ ,trail:-,nbsp:+
set shortmess=filnxtToOF
" Enable plugin behavior
" https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins
" https://www.lazyvim.org/plugins
" gcc and gc<action> mappings.
Plug 'tpope/vim-commentary'
" s action, such as cs"' (replace " with '), ds" (unquote)
Plug 'tpope/vim-surround'
" Enable the whichkey plugin, available on Jetbrains marketplace
set which-key
" Extended matching. A Neovim default plugin.
set matchit
" Key maps
" https://www.lazyvim.org/configuration/keymaps
" To track Action-IDs
" :action VimFindActionIdAction
" General Keymaps
" Go to Left Window
nmap <C-h> <C-w>h
" Go to Lower Window
nmap <C-j> <C-w>j
" Go to Upper Window
nmap <C-k> <C-w>k
" Go to Right Window
nmap <C-l> <C-w>l
" Increase Window Height
nmap <C-Up> <Action>(IncrementWindowHeight)
" Decrease Window Height
nmap <C-Down> <Action>(DecrementWindowHeight)
" Decrease Window Width
nmap <C-Left> <Action>(DecrementWindowWidth)
" Increase Window Width
nmap <C-Right> <Action>(IncrementWindowWidth)
" Move Down
nmap <A-j> <Action>(MoveLineDown)
imap <A-j> <Esc><Action>(MoveLineDown)i
" Move Up
nmap <A-k> <Action>(MoveLineUp)
imap <A-k> <Esc><Action>(MoveLineUp)i
" Prev Buffer
nmap <S-h> <Action>(PreviousTab)
" Next Buffer
nmap <S-l> <Action>(NextTab)
" Prev Buffer (alternative)
nmap [b <Action>(PreviousTab)
" Next Buffer (alternative)
nmap ]b <Action>(NextTab)
" Switch to Other Buffer
nnoremap <leader>bb <C-^>
" Switch to Other Buffer (alternative)
nnoremap <leader>` <C-^>
" Delete Buffer
nmap <leader>bd <Action>(CloseContent)
" Delete Buffer and Window
nmap <leader>bD <Action>(CloseContent)
" Delete Other Buffers
nmap <leader>bo <Action>(CloseAllEditorsButActive)
" Escape and Clear hlsearch
nmap <esc> :nohlsearch<CR>
nmap <leader>ur :nohlsearch<CR>
" Keywordprg
nmap <leader>K :help<space><C-r><C-w><CR>
" Add Comment Below
nmap gco o<c-o>gcc
" Add Comment Above
nmap gcO O<c-o>gcc
" Lazy
nmap <leader>l <Action>(WelcomeScreen.Plugins)
" New File
nmap <leader>fn Action(NewElementSamePlace)
" Location List
nmap <leader>xl <Action>(ActivateProblemsViewToolWindow)
" Quickfix List
nmap <leader>xq <Action>(ActivateProblemsViewToolWindow)
" Previous Quickfix
nmap [q <Action>(GotoPreviousError)
" Next Quickfix
nmap ]q <Action>(GotoNextError)
" Format
nmap <leader>cf <Action>(Format)
vmap <leader>cf <Action>(Format)
" Line Diagnostics
nmap <leader>cd <Action>(ActivateProblemsViewToolWindow)
" Next Diagnostic
nmap ]d <Action>(GotoNextError)
" Prev Diagnostic
nmap [d <Action>(GotoPreviousError)
" Next Error
nmap ]e <Action>(GotoNextError)
" Prev Error
nmap [e <Action>(GotoPreviousError)
" Next Warning
nmap ]w <Action>(GotoNextError)
" Prev Warning
nmap [w <Action>(GotoPreviousError)
" Toggle Auto Format (Global)
nmap <leader>ub :echo 'There is no equivalent mapping for Toggle Auto Format.'<cr>
" Toggle Auto Format (Buffer)
nmap <leader>uB :echo 'There is no equivalent mapping for Toggle Auto Format.'<cr>
" Toggle Spelling
nmap <leader>us :setlocal spell!<CR>
" Toggle Wrap
nmap <leader>uw :setlocal wrap!<CR>
" Toggle Relative Number
nmap <leader>uL :set relativenumber!<CR>
" Toggle Diagnostics
nmap <leader>ud <Action>(ActivateProblemsViewToolWindow)
" Toggle Line Numbers
nmap <leader>ul :set number!<CR>
" Toggle conceallevel
nmap <leader>uc :echo 'There is no equivalent mapping for Toggle Conceallevel.'<cr>
" Toggle Treesitter Highlight
nmap <leader>uT :echo 'There is no equivalent mapping for Toggle Treesitter Highlight.'<cr>
" Toggle Background
nmap <leader>ub <Action>(QuickChangeScheme)
" Toggle Inlay Hints
nmap <leader>uh :echo 'There is no equivalent mapping for Toggle Inlay Hints.'<cr>
" Lazygit (Root Dir)
nmap <leader>gg <Action>(ActivateCommitToolWindow)
" Lazygit (cwd)
nmap <leader>gG <Action>(ActivateCommitToolWindow)
" Git Blame Line
nmap <leader>gb <Action>(Annotate)
" Git Browse
nmap <leader>gB <Action>(Vcs.Show.Log)
" Lazygit Current File History
nmap <leader>gf <Action>(Vcs.ShowTabbedFileHistory)
" Lazygit Log
nmap <leader>gl <Action>(Vcs.Show.Log)
" Lazygit Log (cwd)
nmap <leader>gL <Action>(Vcs.Show.Log)
" Quit All
nmap <leader>qq <Action>(Exit)
" Inspect Pos
nmap <leader>ui <Action>(ActivateStructureToolWindow)
" Inspect Tree
nmap <leader>uI <Action>(ActivateStructureToolWindow)
" LazyVim Changelog
nmap <leader>L <Action>(WhatsNewAction)
" Terminal (Root Dir)
nmap <leader>ft <Action>(ActivateTerminalToolWindow)
" Terminal (cwd)
nmap <leader>fT <Action>(ActivateTerminalToolWindow)
" Terminal (Root Dir)
nmap <C-/> <Action>(ActivateTerminalToolWindow)
" nmap <C-_> 'There is no equivalent mapping for <c-_>.'<cr>
" Hide Terminal - terminal mode maps not possible
" Split Window Below. :split<cr> doesn't work.
nmap <leader>- <c-w>s
" Split Window Right
nmap <leader><bar> <c-w>v
" Delete Window
nmap <leader>wd <Action>(CloseContent)
" Toggle Maximize
nmap <leader>wm <Action>(ToggleDistractionFreeMode)
" Tabs are treated as saved layouts
" Last Tab
nmap <leader><tab>l <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout)
" Close Other Tabs
nmap <leader><tab>o :<cr>
" First Tab
nmap <leader><tab>f <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout)
" New Tab
nmap <leader><tab>f <Action>(StoreDefaultLayout)<Action>(StoreNewLayout)
" Next Tab
nmap <leader><tab>] <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout)
" Previous Tab
nmap <leader><tab>[ <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout)
" Close Tab
nmap <leader><tab>f <Action>(StoreDefaultLayout)<Action>(ChangeToolWindowLayout)
" LSP Keymaps
" Lsp Info
nmap <leader>cc :echo 'There is no equivalent mapping for Lsp Info.'<cr>
" Goto Definition
nmap gd <Action>(GotoDeclaration)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" References
nmap gr <Action>(FindUsages)
" Goto Implementation
nmap gI <Action>(GotoImplementation)
" Goto Type Definition
nmap gy <Action>(GotoTypeDeclaration)
" Goto Declaration
nmap gD <Action>(GotoDeclaration)
" Signature Help
nmap gK <Action>(ParameterInfo)
" Signature Help in Insert Mode
imap <C-k> <C-o><Action>(ParameterInfo)
" Code Action
nmap <leader>ca <Action>(RefactoringMenu)
vmap <leader>ca <Action>(RefactoringMenu)
" Run Codelens
nmap <leader>cc :echo 'There is no equivalent mapping for Run Codelens.'<cr>
" Refresh & Display Codelens
nmap <leader>cC :echo 'There is no equivalent mapping for Refresh & Display Codelens.'<cr>
" Rename File
nmap <leader>cR <Action>(RenameFile)
" Rename
nmap <leader>cr <Action>(RenameElement)
" Source Action
nmap <leader>cA <Action>(ShowIntentionActions)
" Next Reference
nmap ]] <Action>(GotoNextError)
" Prev Reference
nmap [[ <Action>(GotoPreviousError)
" Next Reference (alternative)
nmap <a-n> <Action>(GotoNextError)
" Prev Reference (alternative)
nmap <a-p> <Action>(GotoPreviousError)
" Bufferline
" Delete buffers to the left
nmap <leader>bl <Action>(CloseAllToTheLeft)
" Toggle pin
nmap <leader>bp <Action>(PinActiveTabToggle)
" Delete Non-Pinned Buffers
nmap <leader>bP <Action>(CloseAllUnpinnedEditors)
" Delete buffers to the right
nmap <leader>br <Action>(CloseAllToTheRight)
" Neo-tree Keymaps
" Buffer Explorer
nmap <leader>be <Action>(ActivateProjectToolWindow)
" Explorer NeoTree (Root Dir)
nmap <leader>e <Action>(FileStructurePopup)
" Explorer NeoTree (cwd)
nmap <leader>E <Action>(SelectInProjectView)
" Explorer NeoTree (Root Dir) (alternative)
nmap <leader>fe <Action>(ActivateProjectToolWindow)
" Explorer NeoTree (cwd) (alternative)
nmap <leader>fE <Action>(ActivateProjectToolWindow)
" Git Explorer
nmap <leader>ge <Action>(ActivateVersionControlToolWindow)
" Notifications (noice, snacks)
nmap <leader>snd <Action>(ClearAllNotifications)
nmap <leader>un <Action>(ClearAllNotifications)
" Telescope Keymaps
" Find Files (Root Dir)
nmap <leader><space> <Action>(GotoFile)
" Switch Buffer
nmap <leader>, <Action>(Switcher)
" Grep (Root Dir)
nmap <leader>/ <Action>(FindInPath)
" Command History
nmap <leader>: :history<cr>
" Buffers
nmap <leader>fb <Action>(Switcher)
" Find Config File
nmap <leader>fc <Action>(GotoFile)
" Find Files (Root Dir) (alternative)
nmap <leader>ff <Action>(GotoFile)
" Find Files (cwd)
nmap <leader>fF <Action>(GotoFile)
" Find Files (git-files)
nmap <leader>fg <Action>(GotoFile)
" Recent
nmap <leader>fr <Action>(RecentFiles)
" Recent (cwd)
nmap <leader>fR <Action>(RecentFiles)
" Commits
nmap <leader>gc <Action>(Vcs.Show.Log)
" Status
nmap <leader>gs <Action>(Vcs.Show.Log)
" Registers
nmap <leader>s" :registers<cr>
" Auto Commands
nmap <leader>sa :echo 'There is no equivalent mapping.'<cr>
" Buffer
nmap <leader>sb <Action>(Switcher)
" Command History (alternative)
nmap <leader>sc :history<cr>
" Commands
nmap <leader>sC <Action>(GotoAction)
" Document Diagnostics
nmap <leader>sd <Action>(ActivateProblemsViewToolWindow)
" Workspace Diagnostics
nmap <leader>sD <Action>(ActivateProblemsViewToolWindow)
" Grep (Root Dir) (alternative)
nmap <leader>sg <Action>(FindInPath)
" Grep (cwd)
nmap <leader>sG <Action>(FindInPath)
" Help Pages
nmap <leader>sh <Action>(HelpTopics)
" Search Highlight Groups
nmap <leader>sH <Action>(HighlightUsagesInFile)
" Jumplist
nmap <leader>sj <Action>(RecentLocations)
" Key Maps
nmap <leader>sk :map<cr>
" Location List
nmap <leader>sl <Action>(ActivateProblemsViewToolWindow)
" Jump to Mark
nmap <leader>sm :marks<cr>
" Man Pages
nmap <leader>sM <Action>(ShowDocumentation)
" Options
nmap <leader>so <Action>(ShowSettings)
" Quickfix List
nmap <leader>sq <Action>(ActivateProblemsViewToolWindow)
" Resume
nmap <leader>sR :echo 'Not yet implmented.'<cr>
" Goto Symbol
nmap <leader>ss <Action>(GotoSymbol)
" Goto Symbol (Workspace)
nmap <leader>sS <Action>(GotoSymbol)
" Word (Root Dir)
nmap <leader>sw <Action>(FindWordAtCaret)
" Word (cwd)
nmap <leader>sW <Action>(FindWordAtCaret)
" Selection (Root Dir)
vmap <leader>sw <Action>(FindWordAtCaret)
" Selection (cwd)
vmap <leader>sW <Action>(FindWordAtCaret)
" Colorscheme with Preview
nmap <leader>uC <Action>(QuickChangeScheme)
" DAP Keymaps
" Run with Args
nmap <leader>da <Action>(ChooseRunConfiguration)
" Toggle Breakpoint
nmap <leader>db <Action>(ToggleLineBreakpoint)
" Breakpoint Condition
nmap <leader>dB <Action>(AddConditionalBreakpoint)
" Continue
nmap <leader>dc <Action>(Resume)
" Run to Cursor
nmap <leader>dC <Action>(ForceRunToCursor)
" Go to Line (No Execute)
nmap <leader>dg :echo 'Not yet implemented.'<cr>
" Step Into
nmap <leader>di <Action>(StepInto)
" Down
nmap <leader>dj <Action>(GotoNextError)
" Up
nmap <leader>dk <Action>(GotoPreviousError)
" Run Last
nmap <leader>dl <Action>(Debug)
" Step Out
nmap <leader>do <Action>(StepOut)
" Step Over
nmap <leader>dO <Action>(StepOver)
" Pause
nmap <leader>dp <Action>(Pause)
" Toggle REPL
nmap <leader>dr <Action>(JShell.Console)
" Session
nmap <leader>ds :echo 'Not yet implmented.'<cr>
" Terminate
nmap <leader>dt <Action>(Stop)
" Widgets
nmap <leader>dw :echo 'There is no equivalent mapping for Widgets.'<cr>
" Todo-comments Keymaps
" Todo
nmap <leader>st oTODO<esc>gcc
" Todo/Fix/Fixme
nmap <leader>sT :echo 'Not yet implemented.'<cr>
" Todo (Trouble)
nmap <leader>xt :echo 'Not yet implemented.'<cr>
" Todo/Fix/Fixme (Trouble)
nmap <leader>xT :echo 'Not yet implemented.'<cr>
" Previous Todo Comment
nmap [t ?TODO<cr>
" Next Todo Comment
nmap ]t /TODO<cr>
" DAP UI Keymaps
" Eval
nmap <leader>de <Action>(EvaluateExpression)
vmap <leader>de <Action>(EvaluateExpression)
" Dap UI
nmap <leader>du <Action>(ActivateDebugToolWindow)
" Neotest Keymaps
" Run Last
nmap <leader>tl <Action>(Run)
" Show Output
nmap <leader>to :echo 'Not yet implemented.'<cr>
" Toggle Output Panel
nmap <leader>tO :echo 'Not yet implemented.'<cr>
" Run Nearest
nmap <leader>tr <Action>(RunClass)
" Toggle Summary
nmap <leader>ts <Action>(ShowTestSummary)
" Stop
nmap <leader>tS <Action>(Stop)
" Run File
nmap <leader>tt <Action>(RunClass)
" Run All Test Files
nmap <leader>tT <Action>(RunAllTests)
" Toggle Watch
nmap <leader>tw <Action>(ToggleTestWatch)
" nvim-dap
" Debug Nearest
nmap <leader>td <Action>(ChooseDebugConfiguration)
" Neovim mappings
" https://neovim.io/doc/user/vim_diff.html#_default-mappings
nnoremap Y y$
inoremap <C-U> <C-G>u<C-U>
inoremap <C-W> <C-G>u<C-W>
" Q isn't exactly the same.
nnoremap Q @@
" There are several more Neovim mappings that need to be ported.