-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelix.ideavimrc
273 lines (198 loc) · 8.24 KB
/
helix.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
" ===配置插件===
set which-key
set quickscope
" 这个是vim的插件,暂时不起作用
" set surround
" ====配置特性===
set showmode
set incsearch
set hlsearch
" Leader_keys
let mapleader = " "
" ===========配置键值和which-key==========
set notimeout
let g:WhichKey_ShowVimActions = "false"
" ---空格模式---
let g:WhichKeyDesc_Files = "<leader>f Find in files"
map <leader>f <Action>(GotoFile)
let g:WhichKeyDesc_Path = "<leader>/ Find in path"
map <leader>/ <Action>(FindInPath)
let g:WhichKeyDesc_Windows = "<leader>w Windows"
let g:WhichKeyDesc_Recent = "<leader>b Recent files"
map <leader>b <Action>(RecentFiles)
let g:WhichKeyDesc_Symbols = "<leader>s Buffer symbols"
map <leader>s <Action>(FileStructurePopup)
let g:WhichKeyDesc_AllSymbols = "<leader>S Workspace symbols"
map <leader>S <Action>(GotoSymbol)
let g:WhichKeyDesc_Perform = "<leader>a Perform code action"
map <leader>a <Action>(ShowIntentionActions)
let g:WhichKeyDesc_Rename = "<leader>r Rename symbol"
" map <leader>r <Action>(Refactorings.QuickListPopupAction)
map <leader>r <Action>(RenameElement)
let g:WhichKeyDesc_Diag = "<leader>d Open diagnostics picker"
map <leader>d <Action>(ActivateProblemsViewToolWindow)
let g:WhichKeyDesc_RecentLocations = "<leader>j Open jumpList"
map <leader>j <Action>(RecentLocations)
let g:WhichKeyDesc_Copy = "<leader>y Copy to clipboard"
vnoremap <leader>y "+y
let g:WhichKeyDesc_Paste = "<leader>p Paste from clipboard"
vnoremap <leader>p "+p
" ---g跳转模式---
let g:WhichKeyDesc_GoToFileStart = "gg Goto first line"
let g:WhichKeyDesc_GoToEndOfFile = "ge Goto last line"
nnoremap ge G
vnoremap ge G
let g:WhichKeyDesc_GoToFilesInSelection = "gf List open files"
let g:WhichKeyDesc_GoToLineStart = "gh Goto line start"
nnoremap gh 0
vnoremap gh 0
let g:WhichKeyDesc_GoToLineEnd = "gl Goto line end"
nnoremap gl $
vnoremap gl $
let g:WhichKeyDesc_GoToFirstNonWhitespace = "gs Goto first non-whitespace char"
nnoremap gs ^
vnoremap gs ^
let g:WhichKeyDesc_GoToWindowTop = "gt Goto window top"
nnoremap gt H
vnoremap gt H
let g:WhichKeyDesc_GoToWindowCenter = "gc Goto window center"
nnoremap gc M
vnoremap gc M
let g:WhichKeyDesc_GoToWindowBottom = "gb Goto window bottom"
nnoremap gb L
vnoremap gb L
let g:WhichKeyDesc_GoToDefinition = "gd Goto definition"
nnoremap gd :action GotoDeclaration<CR>
let g:WhichKeyDesc_GoToTypeDefinition = "gy Goto type definition"
" nnoremap gy :action GotoTypeDeclaration<CR>
nnoremap gy :action GotoSuperMethod<CR>
let g:WhichKeyDesc_GoToReferences = "gr Goto references"
nnoremap gr :action FindUsages<CR>
let g:WhichKeyDesc_GoToImplementation = "gi Goto implementation"
nnoremap gi :action GotoImplementation<CR>
let g:WhichKeyDesc_GoToLastAccessedFile = "ga Goto last accessed file"
nnoremap ga :b#<CR>
let g:WhichKeyDesc_GoToLastModifiedFile = "gm Goto last modified file"
nnoremap gm :b#<CR>
let g:WhichKeyDesc_GoToNextBuffer = "gn Goto next buffer"
nnoremap gn :bnext<CR>
let g:WhichKeyDesc_GoToPrevBuffer = "gp Goto previous buffer"
nnoremap gp :bprev<CR>
let g:WhichKeyDesc_GoToLastModification = "g. Goto last modification"
nnoremap g. :action JumpToLastChange<CR>
" --[] syntax语法导航模式---
let g:WhichKeyDesc_NextDiagnostic = "]d Next diagnostic"
map ]d <Action>(GotoNextError)
let g:WhichKeyDesc_PrevDiagnostic = "[d Previous diagnostic"
map [d <Action>(GotoPreviousError)
let g:WhichKeyDesc_NextParagraph = "]p Next paragraph"
map ]p <Action>(EditorCodeBlockEndWithSelection)
let g:WhichKeyDesc_PrevParagraph = "[p Previous paragraph"
map [p <Action>(EditorCodeBlockStartWithSelection)
let g:WhichKeyDesc_NextFunction = "]f Next function"
map ]f <Action>(MethodDown)
let g:WhichKeyDesc_PrevFunction = "[f Previous function"
map [f <Action>(MethodUp)
let g:WhichKeyDesc_NextChange = "]g Next change"
" map ]g <Action>(JumpToNextChange)
map ]g <Action>(VcsShowNextChangeMarker)
let g:WhichKeyDesc_PrevChange = "[g Previous change"
" map [g <Action>(JumpToLastChange)
map [g <Action>(VcsShowPrevChangeMarker)
" --Window模式---
let g:WhichKeyDesc_SplitVert = "<leader>wv Split vertically"
map <leader>wv <Action>(SplitVertically)
let g:WhichKeyDesc_SplitHorz = "<leader>ws Split horizontally"
map <leader>ws <Action>(SplitHorizontally)
let g:WhichKeyDesc_CloseAll = "<leader>wq Close all editors"
map <leader>wq <Action>(CloseAllEditors)
let g:WhichKeyDesc_CloseOther = "<leader>wo Close other editors"
" map <leader>wo <Action>(CloseAllEditorsButActive)
map <leader>wo <Action>(UnsplitAll)
let g:WhichKeyDesc_FocusLeft = "<leader>wh Focus left window"
nnoremap <leader>wh <C-w>h
vnoremap <leader>wh <C-w>h
let g:WhichKeyDesc_FocusDown = "<leader>wj Focus down window"
nnoremap <leader>wj <C-w>j
vnoremap <leader>wj <C-w>j
let g:WhichKeyDesc_FocusUp = "<leader>wk Focus up window"
nnoremap <leader>wk <C-w>k
vnoremap <leader>wk <C-w>k
let g:WhichKeyDesc_FocusRight = "<leader>wl Focus right window"
nnoremap <leader>wl <C-w>l
vnoremap <leader>wl <C-w>l
" ---m匹配环绕模式---
let g:WhichKeyDesc_GotoMatchingBracket = "mm Goto matching bracket"
map mm <Action>(EditorMatchBrace)
let g:WhichKeyDesc_SelectTextobjectInner = "mi Select inside textobject"
let g:WhichKeyDesc_SelectBracketsInner = "mim Select inside matching"
nnoremap mim :action EditorMatchBrace<CR> :action EditorLeft<CR> :action EditorRightWithSelection<CR> :action EditorCodeBlockEndWithSelection<CR>
let g:WhichKeyDesc_SelectFuncInner = "mif Select inside function"
nnoremap mif :action MethodUp<CR> :action EditorCodeBlockEndWithSelection<CR>
let g:WhichKeyDesc_SelectTextobjectAround = "ma Select around textobject"
let g:WhichKeyDesc_SelectWordOuter = "maw Select around word"
map maw <Action>(EditorSelectWord)
let g:WhichKeyDesc_SelectBracketsOuter = "mam Select around matching"
nnoremap mam :action EditorMatchBrace<CR> :action EditorCodeBlockEndWithSelection<CR>
let g:WhichKeyDesc_SelectFuncOuter = "maf Select around function"
nnoremap maf :action MethodUp<CR> :action EditorCodeBlockEndWithSelection<CR>
" let g:WhichKeyDesc_SurroundAdd = "ms Surround selection with char"
" map ms <Plug>YSurround
" let g:WhichKeyDesc_SurroundReplace = "mr Replace surround char <from> with <to>"
" map mr <Plug>CSurround
" let g:WhichKeyDesc_SurroundDelete = "md Delete surround char"
" map md <Plug>DSurround
" ---快捷按键---
map <c-o> <Action>(Back)
map <c-i> <Action>(Forward)
map <c-c> <Action>(CommentByLineComment)
nnoremap d x
vnoremap d :action EditorDelete<CR>
nnoremap x V
vnoremap x :action EditorDownWithSelection<CR>
" nnoremap w :action EditorNextWordWithSelection<CR>
" vnoremap w <ESC>:action EditorNextWordWithSelection<CR>
" nnoremap b :action EditorPreviousWordWithSelection<CR>
" vnoremap b <ESC>:action EditorPreviousWordWithSelection<CR>
" FIXME
vnoremap %s :action SelectAllOccurrences<CR>
nnoremap U <C-R>
" ---额外添加的功能和按键---
" 开启quickscope的按键
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
let g:WhichKeyDesc_Action = "<leader>: Actions"
map <leader><CR> <Action>(GotoAction)
let g:WichKeyDesc_Explorer = "<leader>: Location in explorer"
map <leader>e <Action>(SelectInProjectView)
let g:WhichKeyDesc_Git = "<leader>i Git"
map <leader>i <Action>(ActivateVersionControlToolWindow)
let g:WhichKeyDesc_Terminal = "<leader><Space> Terminal"
" map <leader>t <Action>(Terminal.OpenInTerminal)
map <leader><Space> <Action>(ActivateTerminalToolWindow)
map <c-n> <Action>(GotoNextElementUnderCaretUsage)
map <c-p> <Action>(GotoPrevElementUnderCaretUsage)
map <c-j> <Action>(MoveLineDown)
map <c-k> <Action>(MoveLineUp)
" map <c-l> <Action>(SelectInProjectView)
" 重新定义 Ctrl+u 和 Ctrl+d
nnoremap <C-u> :call ScrollUp(10)<CR>
nnoremap <C-d> :call ScrollDown(10)<CR>
" 定义 ScrollUp 和 ScrollDown 函数
function! ScrollUp(lines)
execute "normal!" a:lines . "k"
endfunction
function! ScrollDown(lines)
execute "normal!" a:lines . "j"
endfunction
" 在插入模式启用补全
autocmd InsertEnter * :call EnableCompletion()
" 在离开插入模式禁用补全
autocmd InsertLeave * :call DisableCompletion()
" 启用补全功能的函数
function! EnableCompletion()
" call CocAction('enableCompletion')
endfunction
" 禁用补全功能的函数
function! DisableCompletion()
" call CocAction('disableCompletion')
endfunction