-
Notifications
You must be signed in to change notification settings - Fork 1
/
_ideavimrc
362 lines (294 loc) · 8 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
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
" support options key
set macmeta
" like key bindings
source $HOME/.vimrc.base
Plug 'preservim/nerdtree'
Plug 'terryma/vim-multiple-cursors'
set surround
set clipboard+=ideaput
set ideajoin
" 书签
nmap mm <action>(ToggleBookmark)
nmap mp <action>(GotoPreviousBookmark)
nmap mn <action>(GotoNextBookmark)
" 运行
nmap <F9> <action>(Run)
imap <F9> <action>(Run)
nmap <S-F9> <action>(RunClass)
imap <S-F9> <action>(RunClass)
" 调试
nmap <F10> <action>(Debug)
imap <F10> <action>(Debug)
nmap <F8> <action>(StepOver)
nmap <F7> <action>(StepInto)
nmap <S-F7> <action>(StepOut)
nmap <F6> <action>(Resume)
" Set breakpoint
nmap <leader>b <action>(ToggleLineBreakPoint)
" Tab
nmap bn <action>(NextTab)
nmap bp <action>(PreviousTab)
" 搜索
nmap <leader>ff <action>(SearchEverywhere)
nmap ff <action>(SearchEverywhere)
nmap <leader>fe <action>(FindInPath)
nmap fe <action>(FindInPath)
nmap fr <action>(RecentChangedFiles)
nmap <leader>gr <action>(RecentChangedFiles)
nmap <leader>s <action>(FileStructurePopup)
" noremap \fp <action>(FindInPath)
" noremap \ff <action>(GotoFile)
" noremap \fc <action>(GotoClass)
" noremap \gg <action>(FindUsages)
" noremap \fi <action>(GotoDeclaration)
" 代码折叠
nmap zo <action>(ExpandRegion)
nmap zz <action>(CollapseRegion)
nmap za <action>(CollapseAllRegions)
nmap <space> <action>(CollapseRegion)
" 格式化代码
nmap = <action>(ReformatCode)
vmap = <action>(ReformatCode)
" clear unused imports
nmap <leader>w <action>(OptimizeImports):%s/\s\+$//g<CR>
" Generate
nmap \ge j<action>(Generate)
imap \ge <Esc>j<action>(Generate)
"Ctrl+h/j/k/l切换窗口
nmap <Up> <c-w>k
nmap <Down> <c-w>j
nmap <Left> <c-w>h
nmap <Right> <c-w>l
"auto correct
map \cr <action>(ShowIntentionActions)
imap \cr <action>(ShowIntentionActions)
" 注释
nmap \ci <action>(CommentByLineComment)
imap \ci <Esc><action>(CommentByLineComment)
vmap \ci <action>(VimVisualSwapSelections)<action>(CommentByLineComment)<Esc>
" 多行编辑
vmap <C-n> <A-n>
vmap <C-x> <A-x>
" rename variables
nmap <leader>rn <action>(RenameElement)
" 函数跳转
" nmap gd <c-]><esc>
nmap gi <action>(GotoImplementation)
nmap gr <action>(FindUsages)
nmap go <action>(Back)
nmap gp <action>(JumpToLastChange)
nmap gn <action>(JumpToNextChange)
nmap gq <action>(GotoNextError)
" sethandler <F2> a:vim
nmap <F2> :NERDTreeToggle<CR>
nmap <F3> <action>(ActivateTerminalToolWindow)
nmap <F4> :NERDTreeFind<CR>
nmap <F12> <action>(HideAllWindows)
" selection quotes
nmap <Leader>v vi"
" 选择模式扩大选择范围
vmap v <Action>(EditorSelectWord)
" 选择模式缩小选择范围
vmap V <Action>(EditorUnSelectWord)
set ideavimsupport=
set clipboard+=unnamed
source $HOME/.vimrc.unimap
" Mathematical symbols mappings
inoremap <expr> <M-1> "¬"
inoremap <expr> <M-S-1> "±"
inoremap <expr> <M-2> "∃"
inoremap <expr> <M-S-2> "⇒"
inoremap <expr> <M-3> "∀"
inoremap <expr> <M-S-3> "↦"
inoremap <expr> <M-4> "∪"
inoremap <expr> <M-S-4> "∩"
inoremap <expr> <M-5> "⊔"
inoremap <expr> <M-S-5> "⨅"
inoremap <expr> <M-6> "∨"
inoremap <expr> <M-S-6> "∧"
inoremap <expr> <M-7> "∅"
inoremap <expr> <M-S-7> "→"
inoremap <expr> <M-8> "∘"
inoremap <expr> <M-S-8> "×"
inoremap <expr> <M-9> "⊆"
inoremap <expr> <M-S-9> "⊂"
inoremap <expr> <M-0> "⊇"
inoremap <expr> <M-S-0> "⊃"
inoremap <expr> <M--> "∈"
inoremap <expr> <M-S--> "⤳"
inoremap <expr> <M-=> "≠"
inoremap <expr> <M-S-=> "≈"
inoremap <expr> <M-\> "⊥"
inoremap <expr> <M-S-\> "⊤"
inoremap <expr> <M-[> "⟦"
inoremap <expr> <M-S-[> "⊑"
inoremap <expr> <M-]> "⟧"
inoremap <expr> <M-S-]> "⊒"
inoremap <expr> <M-;> "⊏"
inoremap <expr> <M-S-;> "⊐"
inoremap <expr> <M-,> "≤"
inoremap <expr> <M-S-,> "≪"
inoremap <expr> <M-.> "≥"
inoremap <expr> <M-S-.> "≫"
inoremap <expr> <M-/> "÷"
inoremap <expr> <M-S-/> "Σ"
""Greek alphabet mappings
inoremap <expr> <M-a> "α"
inoremap <expr> <M-S-a> "Λ"
inoremap <expr> <M-b> "β"
inoremap <expr> <M-c> "χ"
inoremap <expr> <M-d> "δ"
inoremap <expr> <M-S-d> "Δ"
inoremap <expr> <M-S-e> "ε"
inoremap <expr> <M-f> "ϕ"
inoremap <expr> <M-S-f> "Φ"
inoremap <expr> <M-g> "γ"
inoremap <expr> <M-S-g> "Γ"
inoremap <expr> <M-h> "η"
inoremap <expr> <C-i> "ι"
inoremap <expr> <M-k> "κ"
inoremap <expr> <M-S-l> "λ"
inoremap <expr> <M-j> "Λ"
inoremap <expr> <M-m> "μ"
""niu
inoremap <expr> <M-S-n> "ν"
inoremap <expr> <M-o> "ο"
inoremap <expr> <M-p> "π"
inoremap <expr> <M-S-p> "Π"
inoremap <expr> <M-q> "θ"
inoremap <expr> <M-S-q> "Θ"
inoremap <expr> <M-r> "ρ"
inoremap <expr> <M-s> "σ"
inoremap <expr> <M-t> "τ"
""upsilon
inoremap <expr> <M-S-u> "υ"
inoremap <expr> <M-v> "ϒ"
inoremap <expr> <M-S-v> "¥"
inoremap <expr> <M-w> "ω"
inoremap <expr> <M-S-w> "Ω"
inoremap <expr> <M-x> "ξ"
inoremap <expr> <M-S-x> "Ξ"
inoremap <expr> <M-y> "ψ"
inoremap <expr> <M-S-y> "Ψ"
inoremap <expr> <M-z> "ζ"
set langmenu=none
" iMproved, required
set nocompatible
" Desc: tab
set smarttab
" TAB 切换为空格
set expandtab
" tab=4 个空格
set tabstop=4
" 根据前方代码判断缩进
set cindent shiftwidth=4 " set cindent on to autoinent when editing c/c++ file, with 4 shift width
" 特定参数改变缩进行为, see help cinoptions-values for more details
set cinoptions=>s,e0,n0,f0,{0,}0,^0,:0,=s,l0,b0,g0,hs,ps,ts,is,+s,c3,C0,0,(0,us,U0,w0,W0,m0,j0,)20,*30
" Desc: 缩进
" shift 四舍五入到tab 的倍数
set shiftround
" 下一行复制上一行缩进
set autoindent
" {} 开始时添加缩进
set smartindent
"
" 相对行号
set relativenumber
" 显式当前行号
set nu
" 自动换行
set wrap
" 搜索
set showmatch " show matching paren
set incsearch " do incremental searching
set hlsearch " highlight search terms
set ignorecase " set search/replace pattern to ignore case
set smartcase " set smartcase mode on, If there is upper case character in the search patern, the 'ignorecase' option will be override.
" 剪切板
set clipboard+=unnamed,unnamedplus
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" 指定按一次backspace就删除shiftwidth宽度
set smarttab
" 补全时即使有一个写显式菜单,不自动选第一个
set completeopt=menuone,noselect
" 保留5行
set scrolloff=10
" 关闭系统警告声
set noeb
" 通过闪烁代替警告
set vb
" 任意时刻使用鼠标
set mouse=a
" in visual block mode, cursor can be positioned where there is no actual character
set ve=block
" 解释所有数字为十进制
set nf=
" enable complete in command mode
set wildmenu
set showcmd
set cmdheight=1
" show the cursor position all the time
set ruler
" shortens messages to avoid 'press a key' prompt
set shortmess=aoOtTI
" do not redraw while executing macros (much faster)
set lazyredraw
" for easy browse last line with wrap text
set display+=lastline
" always have status-line
set laststatus=2
" allow to change buffer without saving
set hidden
" 当文件在外部被修改,自动更新该文件
set autoread
" make sure our terminal use 256 color
set termguicolors
set t_Co=256
" File encoding
set encoding=utf-8 " 设置gvim内部编码,默认不更改
set fileencodings=utf-8,ucs-bom,gbk,cp936,latin-1 "设置支持打开的文件的编码
" 默认在右边/下边打开新窗口
set splitright
set splitbelow
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" 0 second to show the matching parent ( much faster )
set matchtime=0
" no autochchdir
set noacd
" 当前行高亮
set cursorline
" mapper
let mapleader ="\\"
" 增强剪切板
map <leader>y "*y
vmap <leader>y "*y
map <leader>p "*p
" w为选择到这个单词结尾
nmap w e
" 缩进后保持v mode
vmap < <gv
vmap > >gv
" 全选
nmap <c-a> ggVG<CR>
" 保存
cmap W w
cmap ww w !sudo tee %
" 全选
map <C-a> ggVG
" paste 后不替换
vmap p "_dP
nmap <c-k> <c-w>k
nmap <c-j> <c-w>j
nmap <c-h> <c-w>h
nmap <c-l> <c-w>l
noremap <Up> <c-w>k
noremap <Down> <c-w>j
noremap <Left> <c-w>h
noremap <Right> <c-w>l
if has('multi_byte_ime')
hi Cursor guifg=bg guibg=White gui=NONE
hi CursorIM guifg=NONE guibg=Skyblue gui=NONE
set iminsert=0 imsearch=0
endif