-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.ideavimrc
More file actions
263 lines (209 loc) · 9.02 KB
/
.ideavimrc
File metadata and controls
263 lines (209 loc) · 9.02 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
" .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
"" -- 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=6
"set number relativenumber
set clipboard=unnamed
nnoremap Y y$
vmap Y "+y
" vnoremap p "0dP
nnoremap <SPACE> <Nop>
let mapleader=" "
set gdefault
" Do incremental searching.
set incsearch
set showmode
set which-key
set notimeout
let g:WhichKey_DefaultDelay = 600
let g:WhichKey_ShowVimActions = "true"
let g:WhichKey_ShowTypedSequence = "true"
let g:WhichKey_SortOrder = "by_key_prefix_first"
let g:WhichKey_SortCaseSensitive = "false"
let g:WhichKey_FontFamily = "JetBrains Mono"
let g:WhichKey_FontSize = 12
" Don't use Ex mode, use Q for formatting.
map Q gq
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
" Highlight copied text
Plug 'machakann/vim-highlightedyank'
" Commentary plugin
Plug 'tpope/vim-commentary'
let g:WhichKeyDesc_Change = "c Change"
let g:WhichKeyDesc_ChangeSurround = "cs Change [S]urround"
let g:WhichKeyDesc_Delete = "d Delete"
let g:WhichKeyDesc_DeleteSurround = "ds Delete [S]urround"
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'michaeljsmith/vim-indent-object'
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)
map <C-h> <C-W>h
map <C-l> <C-W>l
nmap <C-s> :w<cr>
let g:WhichKeyDesc_Error = "<leader>e Error"
let g:WhichKeyDesc_ErrorNext = "<leader>ej Next Error"
nmap <leader>ej <Action>(GotoNextError)
let g:WhichKeyDesc_ErrorPrevious = "<leader>ek Previous Error"
nmap <leader>ek <Action>(GotoPreviousError)
" e[x]ecuting code
let g:WhichKeyDesc_Execute = "<leader>x Execute"
let g:WhichKeyDesc_ExecuteRun = "<leader>xr execute [R]un"
nmap <leader>xr <Action>(Run)
let g:WhichKeyDesc_ExecuteRerun = "<leader>xx e[X]ecute again"
nmap <leader>xx <Action>(Rerun)
let g:WhichKeyDesc_ExecuteBreakpoint "<leader>xb toggle [B]reakpoint
nmap <leader>xb <Action>(ToggleLineBreakpoint)
let g:WhichKeyDesc_ExecuteDebug = "<leader>xd execute [D]ebug"
nmap <leader>xd <Action>(Debug)
let g:WhichKeyDesc_executeCancel = "<leader>xc [C]ancel execution"
nmap <leader>xc<Action>(Stop)
let g:WhichKeyDesc_executeClass = "<leader>xf execute [F]ile"
nmap <leader>xf <Action>(RunClass)
" [R]efactoring Code
let g:WhichKeyDesc_Refactor = "<leader>r Refactor Code"
let g:WhichKeyDesc_RefactorRename = "<leader>rr [R]ename Element"
nmap <leader>rr <Action>(RenameElement)
let g:WhichKeyDesc_RefactorVariable = "<leader>rv Introduce [V]ariable"
nmap <leader>rv <Action>(IntroduceVariable)
let g:WhichKeyDesc_RefactorInline = "<leader>rn I[n]line Variable"
nmap <leader>rn <Action>(Inline)
let g:WhichKeyDesc_RefactorFormat = "<leader>rf [F]ormat Code"
nmap <leader>rf <Action>(ReformatCode)
let g:WhichKeyDesc_RefactorParameter = "<leader>rp Introduce [P]arameter"
nmap <leader>rp <Action>(IntroduceParameter)
let g:WhichKeyDesc_RefactorMethod = "<leader>re Extract [M]ethod"
vmap <leader>re <Action>(ExtractMethod)
map <leader>re <Action>(ExtractMethod)
let g:WhichKeyDesc_RefactorMove = "<leader>rm [M]ove"
vmap <leader>rm <Action>(Move)
nmap <leader>rm <Action>(Move)
let g:WhichKeyDesc_RefactorSignature = "<leader>rs Change [S]ignature "
nmap <leader>rs <Action>(ChangeSignature)
let g:WhichKeyDesc_RefactorUppercase = "<leader>rU change [U]PPERCASE"
nmap <leader>rU viwU
let g:WhichKeyDesc_RefactorLowercase = "<leader>ru change [u]ppercase"
nmap <leader>ru viwu
" [R]un Configuration
let g:WhichKeyDesc_RunConfiguration = "<leader>rc Edit Run [C]onfiguration"
nmap <leader>rc <Action>(editRunConfigurations)
" [T]ext Makros
let g:WhichKeyDesc_Text = "<leader>t Text Makros"
let g:WhichKeyDesc_TextRstHeader2 = "<leader>th Underline current line with char"
nmap <leader>th yypVr
let g:WhichKeyDesc_TestRstHeader1 = "<leader>tH Under- and Overline current line with char"
function! H:Header()
let char = getchar()
return "yypVr" . char . "yykP"
endfunction
nnoremap <leader>tH <SID>Header()
" Sidebar management
let g:WhichKeyDesc_Window = "<leader>w Windows"
let g:WhichKeyDesc_WindowProject = "<leader>wp Open [P]roject Folder"
nmap <leader>wp :NERDTree<cr>
let g:WhichKeyDesc_WindowSelectOpen = "<leader>wo Select [O]pen File"
nmap <leader>wo <Action>(SelectInProjectView)
let g:WhichKeyDesc_WindowDebug = "<leader>wb open De[b]ug Window"
nmap <leader>wb <Action>(ActivateDebugToolWindow)
let g:WhichKeyDesc_WindowCommit = "<leader>wc open [C]ommit Window"
nmap <leader>wc <Action>(ActivateCommitToolWindow)
let g:WhichKeyDesc_WindowDatebase = "<leader>wd open [D]atabase Window"
nmap <leader>wd <Action>(ActivateDatabaseToolWindow)
let g:WhichKeyDesc_WindowStucture = "<leader>ws open [S]tructure Window"
nmap <leader>ws <Action>(ActivateStructureToolWindow)
let g:WhichKeyDesc_WindowTerminal = "<leader>wt open [T]erminal Window"
nmap <leader>wt <Action>(ActivateTerminalToolWindow)
let g:WhichKeyDesc_WindowGit = "<leader>wg open [G]it Window"
nmap <leader>wg <Action>(ActivateVersionControlToolWindow)
let g:WhichKeyDesc_WindowExecute = "<leader>wx open e[X]ecute Window"
nmap <leader>wx <Action>(ActivateRunToolWindow)
let g:WhichKeyDesc_WindowJump = "<leader>wj [J]ump to Bookmark"
nmap <leader>wj <Action>(ActivateBookmarksToolWindow)
let g:WhichKeyDesc_WindowQuickNotes = "<leader>wn open [N]otes"
nmap <leader>wn <Action>(ActivateQuickNotesToolWindow)
" [W]indow Activation
let g:WhichKeyDesc_WindowRecent = "<leader>wr open [R]ecent File"
nmap <leader>wr <Action>(RecentFiles)
let g:WhichKeyDesc_WindowFind = "<leader>wf [F]ind Everywhere"
nmap <leader>wf <Action>(SearchEverywhere)
" [J]ump to Bookmarks
let g:WhichKeyDesc_Jump = "<leader>j Jump to Bookmarks"
let g:WhichKeyDesc_JumpMnemonic = "<leader>jm Toggle Bookmark with [M]nemonic"
nmap <leader>jm <Action>(ToggleBookmarkWithMnemonic)
let g:WhichKeyDesc_JumpToggle = "<leader>jt [T]oggle Bookmark"
nmap <leader>jt <Action>(ToggleBookmark)
let g:WhichKeyDesc_JumpGoto = "<leader>jj [J]ump to Bookmark"
nmap <leader>jj <Action>(Bookmarks.Goto)
" [B]uffer Management
let g:WhichKeyDesc_Buffer = "<leader>b Buffer Management"
let g:WhichKeyDesc_BufferDelete = "<leader>bd [d]elete Buffer"
nmap <leader>bd <Action>(CloseContent)
let g:WhichKeyDesc_BufferDeleteUnpinned = "<leader>bD [D]elete ALL Unpinned Buffers"
nmap <leader>bD <Action>(CloseAllUnpinnedEditors)
let g:WhichKeyDesc_BufferSplitV = "<leader>bs [S]plit Buffer to the right"
nmap <leader>bs <Action>(SplitVertically)<C-h><Action>(CloseContent)<C-l>
let g:WhichKeyDesc_BufferMerge = "<leader>bm [M]erge Buffers"
nmap <leader>bm <Action>(Unsplit)
let g:WhichKeyDesc_BufferMove = "<leader>bo [M]ove Buffer to other side"
nmap <leader>bo <Action>(MoveEditorToOppositeTabGroup)
let g:WhichKeyDesc_BufferPin = "<leader>bp [P]in Buffer"
nmap <leader>bp <Action>(PinActiveEditorTab)
"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)
" [V]im IDE changes
let g:WhichKeyDesc_VimIDE = "<leader>v Vim IDE"
let g:WhichKeyDesc_VimVim = "<leader>vv reload [V]imRc"
nmap <leader>vv <Action>(IdeaVim.ReloadVimRc.reload)
let g:WhichKeyDesc_VimTheme = "<leader>vt change [T]heme"
nmap <leader>vt <Action>(ChangeLaf)
let g:WhichKeyDesc_VimNumbers = "<leader>vn toggle relative line [N]umbers"
nnoremap <leader>vn :set relativenumber!<cr>
" [M]otion enhancements
""nmap vi_ T_vt_
""nmap va_ F_vf_
" expand/shrink selection in visual mode.
vmap } <Action>(EditorSelectWord)
vmap { <Action>(EditorUnSelectWord)
nnoremap <leader>{ vi{V
nnoremap <leader>} va{V
" Some neat tricks
" add , to to the end of a line
let g:WhichKeyDesc_TrailingComma = "<C-Comma> Add trailing ,"
nnoremap <c-,> m`$a,<esc>``
inoremap <c-,> <esc>m`$a,<esc>``
let g:WhichKeyDesc_TrailingSemicolon = "<C-S-Comma> Add trailing ;"
nnoremap <c-s-,> m`$a;<esc>``
inoremap <c-s-,> <esc>m`$a;<esc>``
let g:WhichKeyDesc_TrailingColon = "<C-S-Period> Add trailing ."
nnoremap <c-s-.> m`$a;<esc>``
inoremap <c-s-.> <esc>m`$a;<esc>``
" [C]ode Manipulation
let g:WhichKeyDesc_Duplicate = "<leader>cd [D]uplicate"
nnoremap <leader>cd :t.<cr>
let g:WhichKeyDesc_DuplicateComment = "<leader>cc [C]reate [C]omment of current line
nmap <leader>cc :t.<cr>kgcc
" [M]enu Popups
let g:WhichKey_Menu = "<leader>m Menus"
nnoremap <leader>m<leader> :action MainToolBar<cr>
nnoremap <leader>mm :action MainMenu<cr>
nnoremap <leader>mf :action FileMenu<cr>
nnoremap <leader>me :action EditMenu<cr>
nnoremap <leader>mc :action CodeMenu<cr>
nnoremap <leader>mv :action ViewMenu<cr>
nnoremap <leader>mr :action RefactoringMenu<cr>
nnoremap <leader>mx :action RunMenu<cr>
nnoremap <leader>mt :action ToolsMenu<cr>
nnoremap <leader>mg :action Git.Menu<cr>
nnoremap <leader>mw :action WindowMenu<cr>
nnoremap <leader>mh :action HelpMenu<cr>
" KJump Plugin
nmap <leader><leader>f :action KJumpAction<cr>
nmap <A-f> :action KJumpAction<cr>
nmap <A-S-F> :action KJumpAction.Word1<cr>
sethandler <C-c> v-x:ide n-i:vim
ideavimsupport 'dialog'