-
Notifications
You must be signed in to change notification settings - Fork 6
/
.ideavimrc
254 lines (214 loc) · 6.28 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
set hlsearch
set incsearch
set ignorecase
set smartcase
set autoindent
set smartindent
set showmode
set gdefault
set relativenumber number
set visualbell
set ideajoin
set ideamarks
set surround
set NERDTree
set commentary
set ReplaceWithRegister
set exchange
set argtextobj
set textobj-entire
set textobj-indent
set highlightedyank
set vim-paragraph-motion
set keep-english-in-normal-and-restore-in-insert
set idearefactormode=keep
set ideastatusicon=gray
" Always show statusline
set laststatus=2
" Remap U to <C-r> for easier redo. http://vimbits.com/bits/356
nnoremap U <C-r>
" Select last inserted text
nnoremap gV `[v`]
" Easier indentation
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
" Selection
map + <Action>(EditorSelectWord)
map - <Action>(EditorUnSelectWord)
" Move lines
nnoremap <silent> <C-j> :m .+1<CR>==
nnoremap <silent> <C-k> :m .-2<CR>==
inoremap <silent> <C-j> <Esc>:m .+1<CR>==gi
inoremap <silent> <C-k> <Esc>:m .-2<CR>==gi
vnoremap <silent> <C-j> :m '>+1<CR>gv=gv
vnoremap <silent> <C-k> :m '<-2<CR>gv=gv
" Google
map gx <Action>(com.obroom.plugin.smartsearch.SearchActionGroup)
" Translate
map gK <Action>($EditorTranslateAction)
" DevDocs
map gZ <Action>(DevDocs.Search)
" Insert lines
nmap [<space> O<Esc>j
nmap ]<space> o<Esc>k
" Moving lines
nmap [e <Action>(MoveLineUp)
nmap ]e <Action>(MoveLineDown)
" Moving statements
nmap [s <Action>(MoveStatementUp)
nmap ]s <Action>(MoveStatementDown)
" Unimpaired mappings
nmap [c <Action>(PreviousDiff)
nmap ]c <Action>(NextDiff)
nmap [q <Action>(PreviousOccurence)
nmap ]q <Action>(NextOccurence)
nmap [[ <Action>(MethodUp)
nmap ]] <Action>(MethodDown)
nmap [m <Action>(MethodUp)
nmap ]m <Action>(MethodDown)
nmap [c <Action>(VcsShowPrevChangeMarker)
nmap ]c <Action>(VcsShowNextChangeMarker)
nmap [r <Action>(GotoPreviousError)
nmap ]r <Action>(GotoNextError)
" Code block
nmap g[ <Action>(EditorCodeBlockStart)
nmap g] <Action>(EditorCodeBlockEnd)
" Vim-sandwich styled mappings for vim-surround
unmap cs
unmap ys
unmap ds
map sa <Plug>YSurround
vmap sa <Plug>VSurround
map sd <Plug>DSurround
map sr <Plug>CSurround
" Vim-abolish
map crm <Action>(StringManipulation.ToPascalCaseOrCamelCase)
map crc <Action>(StringManipulation.ToCamelCase)
map crs <Action>(StringManipulation.ToSnakeCase)
map cru <Action>(StringManipulation.ToScreamingSnakeCase)
" Clear highlight
noremap <C-L> :nohlsearch<CR><C-L>
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file.
let mapleader = " "
let maplocalleader = "\\"
" Fast saving
map <leader>w :w!<CR>
" Fast quit
map <leader>q :quit<CR>
map <leader>Q :qa!<CR>
map <leader>o :<C-U>tabonly<CR>
map <leader>O :<C-U>tabonly<CR>
" Hide all windows
map <leader>a <Action>(HideAllWindows)
" Jump to definition in vertical split
map <leader>] <C-W>v<C-]>
" System clipboard
vmap <leader>y "+y
nmap <leader>y "+yy
nmap <leader>p "+p
nmap <leader>P "+P
vmap <leader>p "+p
vmap <leader>P "+P
" Tabs
map ]b <Action>(NextTab)
map [b <Action>(PreviousTab)
map <leader>1 <Action>(GoToTab1)
map <leader>2 <Action>(GoToTab2)
map <leader>3 <Action>(GoToTab3)
map <leader>4 <Action>(GoToTab4)
map <leader>5 <Action>(GoToTab5)
map <leader>6 <Action>(GoToTab6)
map <leader>7 <Action>(GoToTab7)
map <leader>8 <Action>(GoToTab8)
map <leader>9 <Action>(GoToTab9)
" Search
map <leader>/ <Action>(FindInPath)
map <leader>\ <Action>(ReplaceInPath)
map <leader>* <Action>(FindInPath)
map <leader>- <Action>(ShowNavBar)
" Distraction free mode
map <leader>z <Action>(ToggleDistractionFreeMode)
map <leader>Z <Action>(ToggleZenMode)
map <leader>x <Action>(RunAnything)
" Run
map <leader>r <Action>(RunClass)
map <leader>R <Action>(DebugClass)
map <leader>b <Action>(CompileDirty)
map <leader>B <Action>(CompileProject)
map <leader>t <Action>(RerunTests)
map <leader>T <Action>(RerunFailedTests)
" Search
map <C-n> <Action>(SelectInProjectView)
map <C-p> <Action>(SearchEverywhere)
map <C-g>r <Action>(RecentFiles)
map <C-g>w <Action>(Switcher)
map <C-g>a <Action>(GotoAction)
map <C-g>s <Action>(GotoSymbol)
map <C-g>c <Action>(GotoClass)
map <C-g>f <Action>(GotoFile)
" Coding
map <leader>cr <Action>(Refactorings.QuickListPopupAction)
map <leader>cg <Action>(Generate)
map <leader>cn <Action>(NewClass)
map <leader>cs <Action>(SurroundWith)
map <leader>cS <Action>(SurroundWithLiveTemplate)
map <leader>ci <Action>(ImplementMethods)
map <leader>co <Action>(OverrideMethods)
map <leader>cm <Action>(RenameElement))
" Details
map <leader>df <Action>(FindUsages)
map <leader>du <Action>(ShowUsages)
map <leader>dc <Action>(CallHierarchy)
map <leader>dt <Action>(TypeHierarchy)
" Debug
map <leader>es <Action>(ChooseDebugConfiguration)
map <leader>er <Action>(Run)
map <leader>ed <Action>(Debug)
map <leader>ec <Action>(Resume)
map <leader>eq <Action>(Stop)
map <leader>eb <Action>(ToggleLineBreakpoint)
map <leader>eh <Action>(RunToCursor)
map <leader>ei <Action>(StepInto)
map <leader>eo <Action>(StepOut)
map <leader>eO <Action>(StepOver)
map <leader>ev <Action>(EvaluateExpression)
" Go
map <leader>gs <Action>(GotoSuperMethod)
map <leader>gi <Action>(GotoImplementation)
map <leader>gr <Action>(GotoRelated)
map <leader>gd <Action>(GotoTypeDeclaration)
map <leader>gt <Action>(GotoTest)
" Info
map <leader>ia <Action>(ShowIntentionActions)
map <leader>ip <Action>(ParameterInfo)
map <leader>ir <Action>(ExpressionTypeInfo)
map <leader>ie <Action>(ShowErrorDescription)
map <leader>ii <Action>(QuickImplementations)
" Copy path
map <leader>mf <Action>(ReformatCode)
map <leader>mi <Action>(OptimizeImports)
map <leader>mp <Action>(CopyContentRootPath)
map <leader>mr <Action>(CopyReference)
" Tool windows
command! TT action ActivateTerminalToolWindow
command! SS action ActivateServicesToolWindow
command! TD action ActivateTODOToolWindow
command! ST action ActivateStructureToolWindow
command! FT action ActivateFavoritesToolWindow
command! RT action ActivateRunToolWindow
command! DT action ActivateDebugToolWindow
command! GT action ActivateVersionControlToolWindow
command! UT action LocalHistory.ShowHistory
" List
command! BL action ViewBreakpoints
" Git
command! GA action Vcs.QuickListPopupAction
command! GH action Vcs.ShowTabbedFileHistory
command! GU action Vcs.UpdateProject
command! GP action Vcs.Push
command! GC action Vcs.Show.Local.Changes
command! GD action Compare.LastVersion
" Reload
command! Reload action IdeaVim.ReloadVimRc.reload