-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_ideavimrc
More file actions
291 lines (233 loc) · 8.42 KB
/
Copy pathdot_ideavimrc
File metadata and controls
291 lines (233 loc) · 8.42 KB
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
" let mapleader = ","
let mapleader = " "
let localleader = "\\"
set ignorecase
set smartcase
set scrolloff=7 " 7 lines above/below cursor when scrolling
set relativenumber number
" Emulated Plugins
set surround
" set easymotion
set NERDTree
" Copy to system clipboard as well
set clipboard+=unnamed
" Use Idea to join lines smartly
set ideajoin
" Multiple cursors support
set multiple-cursors
nmap <C-down> :action EditorCloneCaretBelow<cr>
vmap <localleader>n :action SelectNextOccurrence<cr>
vmap <localleader>N :action UnselectPreviousOccurrence<cr>
" These settings are from - https://github.com/Valloric/dotfiles/blob/master/intellij/ideavimrc
" Ace jump
" Press `S` in normal mode to activate AceJump mode before the caret
nmap S <Action>(AceBackwardAction)
" Press `s` in normal mode to activate AceJump mode after the caret
nmap s <Action>(AceForwardAction)
" End Ace jump
" Create new vertical splits on right and horizontals on below
" set splitright
" set splitbelow
"
nmap <S-k> :action ShowErrorDescription<cr>
nmap gc :action ShowIntentionActions<cr>
" Use Q for formatting the current paragraph (or visual selection)
vmap Q gq
nmap Q gqap
" key bindings for quickly moving between windows
" h left, l right, k up, j down
" nmap <leader>h <c-w>hce
" nmap <leader>l <c-w>l
" nmap <leader>k <c-w>k
" nmap <leader>j <c-w>j
imap <C-h> <Left>
imap <C-k> <Up>
imap <C-j> <Down>
imap <C-l> <Right>
" multi
" scrolling
nmap <S-left> 20zh
nmap <S-right> 20zl
" Symbols
nmap \s :action ActivateStructureToolWindow<cr>
" Terminal
nmap <C-\> :action ActivateTerminalToolWindow<cr>
" Closing tabs
nmap <leader>q :action CloseContent<cr>
nmap <leader>Q :action ReopenClosedTab<cr>
" Switch projects
nmap <leader>ww :action NextProjectWindow<cr>
" To navigate between split panes
nmap <leader>wo :action NextSplitter<cr>
nmap <leader>wp :action PrevSplitter<cr>
" Alt+Tab is quite good for this action
" nmap <leader>j :action PrevSplitter<cr>
nmap ,s :action PrevSplitter<cr>
" Full screen window
nmap <leader>e :action HideAllWindows<cr>
" Splits manipulation
nmap <leader>ws :action SplitHorizontally<cr>
nmap <leader>wv :action SplitVertically<cr>
nmap <leader>wc :action Unsplit<cr>
nmap <leader>wC :action UnsplitAll<cr>
nmap <leader>wd :action OpenEditorInOppositeTabGroup<cr>
" nmap <leader><leader> :action VimFilePrevious<cr>
" nmap <leader>, :action VimFilePrevious<cr>
" nmap <leader>ww :action JumpToLastWindow<cr>
" NERDTree
"map <leader>ee :NERDTree<CR>
"nmap <leader>eh :action HideActiveWindow<cr>
" Navigation / Movements
nmap <leader>h :action Back<cr>
nmap <leader>l :action Forward<cr>
nmap <leader>rl :action RecentLocations<cr>
nmap <leader>C :action CallHierarchy<cr>
nmap <leader>ff :action GotoFile<cr>
nmap <leader>fg :action FindInPath<cr>
nmap <leader>gc :action GotoClass<cr>
nmap <leader>gs :action GotoSymbol<cr>
nmap <leader>; :action FileStructurePopup<cr>
nmap <leader>M :action ActivateStructureToolWindow<cr>
nmap <leader>d :action ShowErrorDescription<cr>
nmap <C-o> :action Back<CR>
nmap <C-i> :action Forward<CR>
nmap <leader>ns :action SelectInProjectView<cr>
" lsp
nmap gpd :action QuickImplementations<cr>
nmap gpt :action QuickTypeDefinition<cr>
nmap gi :action GotoImplementation<cr>
nmap gd :action GotoDeclaration<cr>
nmap gr :action ShowUsages<cr>
nmap <leader>U :action GotoSuperMethod<cr>
nmap <leader>I :action SelectIn<cr>
nmap <leader>fj :action RecentFiles<cr>
nmap <leader>cl :action RecentChangedFiles<cr>
nmap mm :action ToggleBookmark<cr>
nmap ml :action ShowBookmarks<cr>
nmap mn :action GotoNextBookmarkInEditor<cr>
nmap mp :action GotoPreviousBookmarkInEditor<cr>
nmap <leader>jp :action JumpToLastWindow<cr>
nmap <leader>t :action GotoTest<cr>
nmap <leader>cc :action JumpToLastChange<cr>
" Useful Git actions
nmap <leader>gb :action Vcs.ShowHistoryForBlock<cr>
nmap <leader>gB :action Annotate<cr>
nmap <leader>gp :action Compare.SameVersion<cr>
" nmap <leader>a :action Switcher<cr>
nmap ,a :action GotoAction<cr>
" Errors
nmap ]d :action GotoNextError<cr>
nmap [d :action GotoPreviousError<cr>
" Editor
nmap<leader>F :action ReformatCode<cr>
" Refactorings
vmap T :action Refactorings.QuickListPopupAction<cr>
vmap <leader>rm :action ExtractMethod<cr>
nmap rn :action RenameElement<cr>
nmap <leader>rq :action Refactoring.QuickListPopupAction<cr>
nmap <leader>rg :action Generate<cr>
nmap <leader>rI :action OptimizeImports<cr>
" Inspection
nmap <leader>rc :action InspectCode<cr>
" VCS operations
nmap <leader>yy :action Vcs.Show.Local.Changes<cr>
nmap <leader>yp :action Vcs.QuickListPopupAction<cr>
nmap <leader>ya :action Annotate<cr>
nmap <leader>yl :action Vcs.Show.Log<cr>
nmap <leader>yd :action Compare.LastVersion<cr>
nmap <leader>yP :action Git.Pull<cr>
nmap <leader>yr :action Git.ResolveConflicts<cr>
nmap <leader>yo :action Github.Open.In.Browser<cr>
" Terminal
"nmap <leader>T :action ActivateTerminalToolWindow<cr>
" Gradle
nmap <leader>G :action ActivateGradleToolWindow<cr>
" External GVim
nmap <leader>v :action Tool_External Tools_mvim<cr>
" External Emacs
nmap <leader>E :action Tool_External Tools_emacsclient<cr>
" External Sublime Text
nmap <leader>S :action Tool_External Tools_sublime_text<cr>
" IdeaVim uses 'a' for alt instead of Vim's 'm'
nmap <a-j> 15gj
nmap <a-k> 15gk
" Won't work in visual mode (with vmap) for some reason.
" Use default map of <c-/> for that.
nmap gcc :action CommentByLineComment<cr>
" unimpaired mappings - from https://github.com/saaguero/ideavimrc/blob/master/.ideavimrc
nnoremap [<space> O<esc>j
nnoremap ]<space> o<esc>k
nnoremap [q :action PreviousOccurence<cr>
nnoremap ]q :action NextOccurence<cr>
nnoremap [m :action MethodUp<cr>
nnoremap ]m :action MethodDown<cr>
nnoremap <leader>[ :action VcsShowPrevChangeMarker<cr>
nnoremap <leader>] :action VcsShowNextChangeMarker<cr>
nnoremap [c :action VcsShowPrevChangeMarker<cr>
nnoremap ]c :action VcsShowNextChangeMarker<cr>
" Tabs
nnoremap <S-h> :action PreviousTab<cr>
nnoremap <S-l> :action NextTab<cr>
" Search
nmap <leader>/ :action Find<cr>
nmap <leader>\ :action FindInPath<cr>
" Moving lines
nmap K :action QuickJavaDoc<cr>
"nmap J :action MoveLineDown<cr>
" Moving statements
nmap KK :action MoveElementRight<cr>
nmap JJ :action MoveElementLeft<cr>
" Building, Running and Debugging
nmap ,c :action CompileDirty<cr>
nmap ,r :action Run<cr>
nmap ,R :action RunAnything<cr>
nmap ,b :action Debug<cr>
nmap ,c :action RunClass<cr>
nmap ,d :action DebugClass<cr>
nmap ,t :action RerunTests<cr>
nmap ,T :action RerunFailedTests<cr>
nmap <leader>db :action ToggleLineBreakpoint<cr>
nmap ,i :action ParameterInfo<cr>
" Useful Quick actions
nmap ,, :action QuickJavaDoc<cr>
nmap ,H :action LocalHistory.ShowHistory<cr>
nmap ,e :action JumpToLastChange<cr>
" AceJump shortcut
nmap <leader>j :action AceAction<cr>
nmap ,yy :action CopySourceRootPath<cr>
nmap ,ya :action CopyAbsolutePath<cr>
nmap ,S :action ShowProjectStructureSettings<cr>
" Pin/Unpin active tab
nmap \p :action PinActiveTabToggle<cr>
" JumpToLastChange <M-S-BS>
" JumpToLastWindow <F12>
" QuickActionPopup <M-A-CR>
" QuickActions
" QuickChangeScheme <C-À>
" QuickDocCopy <M-C>
" QuickEvaluateExpression <M-A-F8> button=1 clickCount=1 modifiers=512
" QuickFixes
" QuickImplementations <A- > <M-Y>
" QuickJavaDoc <F1> <C-J> button=2 clickCount=1 modifiers=128
" Clojure specific mappings for Cursive
" nmap \a :action ActivateREPLToolWindow<cr>
"nmap \c :action :cursive.repl.actions/clear-repl<cr>
"nmap \l :action :cursive.repl.actions/load-file<cr>
"nmap \o :action :cursive.repl.actions/jump-to-output<cr>
"nmap \r :action :cursive.repl.actions/jump-to-repl<cr>
"nmap \t :action :cursive.testing.actions/run-ns-tests<cr>
"nmap \T :action :cursive.testing.actions/rerun-last-test<cr>
"nmap \C :action :cursive.testing.actions/remove-test-markers<cr>
" Python specific mappings
" Format code with Black fomatter
" nmap \p :action Tool_External Tools_Black<cr>
" https://youtrack.jetbrains.com/issue/VIM-1846
nnoremap <BS> <C-S-6>
nnoremap <leader><leader> <C-S-6>
" nnoremap <leader><leader> :action Switcher<cr>
" Increase or decrease font size
nnoremap <C-=> :action EditorIncreaseFontSize<cr>
nnoremap <C--> :action EditorDecreaseFontSize<cr>
" Navigate changes
nmap <leader>] :action VcsShowNextChangeMarker
nmap <leader>[ :action VcsShowPrevChangeMarker