-
Notifications
You must be signed in to change notification settings - Fork 1
/
.ideavimrc
322 lines (287 loc) · 8.67 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
" .ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc
""" Map leader to space ------------------------
let mapleader=" "
let maplocalleader="\\"
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
""" Common settings ----------------------------
set incsearch " Do incremental searching.
set nu
set relativenumber
set showmode
set so=5
set clipboard+=unnamed
set clipboard+=ideaput
set hlsearch
""" Additional options ---------------------------
"" ref: https://gist.github.com/mikeslattery/d2f2562e5bbaa7ef036cf9f5a13deff5
set autowrite
set completeopt=menu,menuone,noselect
set conceallevel=1
set confirm " confirm to save changes before exiting modified buffer
set cursorline " enable highlighting of current line
set expandtab " use spaces instead of tabs
set foldlevel=99
set formatoptions=jcroqlnt " tcqj
set grepformat=%f:%l:%c:%m
set grepprg=rg\ --vimgrep
set termguicolors
set smartcase
set smartindent
set signcolumn=yes
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins --------------
" Old Syntax:
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister
set exchange
set ideajoin
set which-key
set notimeout
set timeoutlen=300
set virtualedit=block
" New Syntax:
Plug 'machakann/vim-highlightedyank'
" Plug 'tpope/vim-commentary'
Plug 'preservim/nerdtree'
" Plug 'tpope/vim-surround'
" map ysiw or add surround inner word to gsa
" Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-commentary' " gcc and gc<action> mappings.
" s action, such as cs"' (replace \" with '), ds" (unquote)
Plug 'tpope/vim-surround'
" similar to flash.nvim
Plug 'justinmk/vim-sneak'
" surround maps a - add, d - delete
map gsa ys
map gsd ds
map gsc cs
""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"
" Don't use Ex mode, use Q for formatting.
map Q gq
inoremap kj <Esc>
nnoremap <Esc> :nohl<CR>
" Hover info
nmap K <Action>(ShowHoverInfo)
" window navigation
nmap <C-h> <c-w>h
nmap <C-l> <c-w>l
nmap <C-j> <c-w>j
nmap <C-k> <c-w>k
nmap <tab> <c-w>w
nmap <A-h> <c-w>h
nmap <A-l> <c-w>l
nmap <A-j> <c-w>j
nmap <A-k> <c-w>k
" 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 <C-n> <Action>(MoveLineDown)
imap <C-n> <Esc><Action>(MoveLineDown)i
" Move Up
nmap <C-p> <Action>(MoveLineUp)
" window controls
map <leader>wv <Action>(SplitVertically)
map <leader>wh <Action>(SplitHorizontally)
map <leader>wd <Action>(CloseContent)
" center cursor when scroll ctrl u & d
nnoremap <C-u> <c-u>zz
nnoremap <C-d> <c-d>zz
nnoremap <S-l> :action NextTab<CR>
nnoremap <S-h> :action PreviousTab<CR>
nnoremap \e :e ~/.ideavimrc<CR>
nnoremap \r :action IdeaVim.ReloadVimRc.reload<CR>
vnoremap < <gv
vnoremap > >gv
""" IdeaVim-specific settings
" set ideajoin " J -> on selected block to "join" lines together
set ideawrite " value: "file" or "all" (default "all")
sethandler <c-c> n-v:vim i:vim
sethandler <c-v> n:vim i:ide
""" IdeaVim IDE actions settings ------------------
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" -- see Actions List here: -- https://gist.github.com/zchee/9c78f91cc5ad771c1f5d
"" --> or go to Actions, type "track action id"
"" --> or :actionlist
" -- General Utils Maps -- "
" map <c-\> <Action>(ActivateTerminalToolWindow)
" --> already mapped to <c-`> (VSCODE SHORTCUT)
map <c-z> <Action>(ToggleDistractionFreeMode)
map <c-\> <Action>(SplitVertically)
map <c-=> <Action>(Unsplit)
" <c-s-l> or ctrl shift l --> for select all occurences (VSCODE SHORTCUT)
map <c-f> <Action>(Find)
map <c-n> <Action>(Down)
map <c-p> <Action>(Up)
map <c-s-c> <Action>(EditorCopy)
map <c-s-v> <Action>(EditorPaste)
" -- g Maps -> go to -- "
map gi <Action>(QuickImplementations)
map gI <Action>(GotoImplementation)
" map gd -> has native Go-to-Definition, jumping files
map gr <Action>(ShowUsages)
map gR <Action>(FindUsages)
" -- DAP (Debugging) Maps -- "
" Run with Args
nmap <leader>dd <Action>(ChooseRunConfiguration)
" Toggle Breakpoint
nmap <leader>db <Action>(ToggleBreakpointAction)
" Breakpoint Condition
nmap <leader>dB <Action>(ToggleBreakpointAction)
" Continue
nmap <leader>dc <Action>(Resume)
" Run to Cursor
nmap <leader>dC <Action>(ForceRunToCursor)
" Go to Line (No Execute)
nmap <leader>dg <Action>(GotoLine)
" 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>
" Eval
nmap <leader>de <Action>(EvaluateExpression)
vmap <leader>de <Action>(EvaluateExpression)
" Dap UI
nmap <leader>du :echo 'Not yet implemented.'<cr>
" -- Leader Maps -- "
map <leader>fr <Action>(RecentFiles)
map <leader>ff <Action>(GotoFile)
map <leader>fn <Action>(NewFile)
map <leader>fH <Action>(ShowNavBar)
map <leader>cf <Action>(ReformatCode)
map <leader>cr <Action>(RenameElement)
map <leader>cd <Action>(ShowErrorDescription)
map <leader>ca <Action>(ShowIntentionActions)
map <leader>cs <Action>(FileStructurePopup)
map <leader>bd <Action>(CloseContent)
map <leader>xx <Action>(ActivateProblemsViewToolWindow)
" map <leader>sa <Action>(GotoAction)
" -- Plugin Leader Maps -- "
map <leader>fe <Action>(com.mituuz.fuzzier.Fuzzier)
map <leader>mf <Action>(com.mituuz.fuzzier.FuzzyMover)
map <leader>fg <Action>(com.mituuz.fuzzier.FuzzierVCS)
" Multi-cursor
map <leader>vm <a-n>
" map <leader>a <Action>(Annotate)
map <leader>e :NERDTreeToggle<CR>
" Unpolluted Paste
map <leader>p "0p
map <a-t> <Action>(ActivateTerminalToolWindow)
map <a-,> <Action>(ShowSettings)
map <leader>q <Action>(HideActiveWindow)
" this doesn't work :(
" map <a-n> <Action>(Tree-selectNext)
" map <a-p> <Action>(Tree-selectPrevious)
" 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>: <Action>(ShowCommands)
" Find Files (Root Dir) (alternative)
nmap <leader>fe <Action>(GotoFile)
" Find Files (cwd)
nmap <leader>fd <Action>(GotoFile)
" Buffers
nmap <leader>fb <Action>(Switcher)
" Find Config File
nmap <leader>fc <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 <Action>(ShowCommands)
" Commands
nmap <leader>sC <Action>(ShowCommands)
" Document Diagnostics
nmap <leader>sd <Action>(ShowErrorsInProject)
" Workspace Diagnostics
nmap <leader>sD <Action>(ShowErrorsInProject)
" 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 :echo "Not yet implemented."<cr>
" 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)