-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
229 lines (188 loc) Β· 7.49 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
set so=5 " Keep few lines visible when scrolling
set notimeout
set number
set timeoutlen=5000
""" Editing and Reloading the Config
nnoremap \e :e ~/.ideavimrc<CR>
nnoremap \R :action IdeaVim.ReloadVimRc.reload<CR>
"" Plugins --------------------------------
""" Surround Plugin --------------------------------
" Emulates vim-surround. Mappings to easily delete, change and add such surroundings in pairs
" Basic Commands:
" cs Change surroundings
" cst Change surroundings tag
" ds Delete surroundings
" dst Delete surroundings tag
" ys Surround text object
" See https://github.com/tpope/vim-surround/blob/master/doc/surround.txt for details
set surround
""" argtextobj Plugin --------------------------------
" Emulates argtextobj. Provides a text-object 'a' for function arguments
" ai
" aa
" See https://www.vim.org/scripts/script.php?script_id=2699 for details
set argtextobj
let g:argtextobj_pairs="[:],(:),<:>"
""" exchange Plugin --------------------------------
" Emulates exchange.vim. Text exchange
" Basic Commands:
" cx First use to define the exchange, second use defines the second and exchange
" cxx Like cx for an entire line
" X Like cx for visual mode
" See https://www.vim.org/scripts/script.php?script_id=2699 for details
Plug 'tommcdo/vim-exchange'
""" easy motion plugin --------------------------------
" Emulates vim-easymotion
" Make sure to install IdeaVim-EasyMotion and AceJump Plugins
" Basid Commands:
" easy-motion-s Search backward
" easy-motion-f Search forward
" See https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands for details
set easymotion
map <leader>f <Plug>(easymotion-s)
map <leader>F <Plug>(easymotion-f)
""" NERDTree plugin --------------------------------
" Emulates NERDTree
" Basic Commands:
" Ctrl-n Open NERDTree (mapped bellow)
" q Close the NERDTree windowe
" o Open files, directories and bookmarks
" go Open selected file, but leave cursor in the NERDTree
" i Open selected file in a split window
" gi Same as i, but leave the cursor on the NERDTree
" s Open selected file in a new vsplit
" gs Same as s, but leave the cursor on the NERDTree
" <C-J> Jump down to next sibling of the current directory
" <C-K> Jump up to previous sibling of the current directory
" R Recursively refresh the current root
" m Display the NERDTree menu
" See https://github.com/JetBrains/ideavim/wiki/NERDTree-support for details
set NERDTree
map <C-n> :NERDTreeToggle<CR>
""" multiple-cursors plugin --------------------------------
" Emulates vim-multiple-cursors
" Basic Commands:
" <C-n> start multicursor
" <C-n> next match
" <C-x> skip next match
" <C-p> remove current match and go back to previous one
" See https://github.com/terryma/vim-multiple-cursors for details
set multiple-cursors
map mc <A-n>
map mx <A-x>
map mp <A-p>
""" Commentary plugin --------------------------------
Plug 'tpope/vim-commentary'
""" ReplaceWithRegister plugin --------------------------------
" Emulates ReplaceWithRegister
" Basic Commands:
" [count]["x]grr Replace [count] lines with the contents of register x.
" {Visual}["x]gr Replace the selection with the contents of register x.
" See https://github.com/vim-scripts/ReplaceWithRegister for details
Plug 'vim-scripts/ReplaceWithRegister'
""" textobj-entire plugin --------------------------------
" Emulates vim-textobj-entire
" Basic Commands:
" {motion}ae Apply motion on entire text
" {motion}ie Apply motion on entire text w/o trailing and leading empty lines
" See https://github.com/kana/vim-textobj-entire for details
set textobj-entire
""" highlightedyank plugin --------------------------------
" Emulates vim-highlightedyank
" Highlight yanked text
" See https://github.com/machakann/vim-highlightedyank for details
Plug 'machakann/vim-highlightedyank'
Plug 'michaeljsmith/vim-indent-object'
"" Common settings -------------------------
set clipboard+=unnamed " Clipboard sharing for Mac Os
set clipboard+=ideaput
set so=5 " Keep few lines visible when scrolling
"" which-key
set which-key
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
let g:qs_primary_color = '#e64553'
let g:qs_secondary_color = '#fe640b'
let g:qs_accepted_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '{', '}', '[', ']', '<', '>']
""" The Escape button
map <C-c> <Esc>
""" The Leader Key
let mapleader=" "
""" Distraction Free Mode
nnoremap <c-z> :action ToggleDistractionFreeMode<CR>
""" Terminal
nnoremap <c-t> :action ActivateTerminalToolWindow<CR>
""" Navigation
nnoremap <c-\> :action SplitVertically<CR>
nnoremap <c--> :action SplitHorizontally<CR>
nnoremap <c-m> :action MoveEditorToOppositeTabGroup<CR>
sethandler <c-j> a:vim
sethandler <c-k> a:vim
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <TAB> :action NextTab<CR>
nnoremap <s-TAB> :action PreviousTab<CR>
nnoremap ;q :action CloseContent<CR>
nnoremap ;a :action CloseAllEditors<CR>
""" Editing source code
set ideajoin
set idearefactormode=keep
vnoremap < <gv
vnoremap > >gv
nnoremap <leader>r :action Replace<CR>
nnoremap [[ :action MethodUp<CR>
nnoremap ]] :action MethodDown<CR>
nnoremap zc :action CollapseRegion<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap <leader>zc :action CollapseAllRegions<CR>
nnoremap <leader>zo :action ExpandAllRegions<CR>
nnoremap <leader>c :action CommentByLineComment<CR>
nnoremap <Leader>= :action ReformatCode<CR>
nnoremap <leader>o :action OptimizeImports<CR>
nnoremap ;r :action RecentFiles<CR>
nnoremap <leader>l :action RecentLocations<CR>
nnoremap <leader>h :action LocalHistory.ShowHistory<CR>
nnoremap ge :action GotoNextError<CR>
nnoremap gE :action GotoPreviousError<CR>
" Alt+j/k for autocompletion popup
inoremap <A-j> <C-n>
inoremap <A-k> <C-p>
" Show hoverdoc
map <leader>h <Action>(ShowErrorDescription)
""" Searching and Source Code Navigation
nnoremap <c-a> :action GotoAction<CR>
nnoremap <leader>u :action FindUsages<CR>
"nnoremap <leader>s :action GotoRelated<CR>
"nnoremap <leader>h :action CallHierarchy<CR>
nnoremap <leader>b :action ShowNavBar<CR>
nnoremap <c-s> :action FileStructurePopup<CR>
nnoremap gs :action GotoSymbol<CR>
"nnoremap gc :action GotoClass<CR>
nnoremap gi :action GotoImplementation<CR>
nnoremap gd :action GotoDeclaration<CR>
nnoremap gp :action GotoSuperMethod<CR>
nnoremap gt :action GotoTest<CR>
nnoremap gb :action Back<CR>
nnoremap gf :action Forward<CR>
""" Tool windows
nnoremap <M-p> :action JumpToLastWindow<CR>
nnoremap <M-x> :action HideAllWindows<CR>
nnoremap <M-m> :action MaximizeToolWindow<CR>
map <leader>sg <Action>(ActivateCommitToolWindow)
map <leader>se <Action>(ActivateProjectToolWindow)
map <leader>sb <Action>(Bookarks.ToolWindow.PopupMenu)
map <leader>sh <Action>(HideSideWindows)
map <leader>bt <Action>(ToggleBookmark)
map <leader>bj <Action>(GotoNextBookmark)
map <leader>bk <Action>(GotoPreviousBookmark)
""" Running and Debugging
nnoremap ,r :action ContextRun<CR>
nnoremap ,c :action RunClass<CR>
nnoremap ,f :action ChooseRunConfiguration<CR>
nnoremap ,t :action ActivateRunToolWindow<CR>
nnoremap ,u :action Rerun<CR>
nnoremap ,f :action RerunFailedTests<CR>
nnoremap ,b :action ToggleLineBreakpoint<CR>
nnoremap ,d :action ContextDebug<CR>
nnoremap ,n :action ActivateDebugToolWindow<CR>