-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
392 lines (376 loc) · 8.04 KB
/
.vimrc
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
"导入默认配置"
if filereadable("/etc/vimrc")
source /etc/vimrc
endif
"避免vi的影响"
set nocompatible
"显示空白字符"
set list
set listchars=tab:>_,eol:\|,trail:*,extends:>,precedes:<,nbsp:@
"显示行号"
set number
"Tab 长度为4"
set tabstop=4
set softtabstop=4
set shiftwidth=4
"不使用空格代替Tab"
set noexpandtab
"自动缩进"
set autoindent
set cindent
set smarttab
set smartindent
"set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s"
"共享剪贴板"
set clipboard+=unnamed
" 当文件被改动时自动载入"
set autoread
"禁止生成临时文件"
set nobackup
set noswapfile
"左右移动可跨行"
set whichwrap+=<
set whichwrap+=>
set whichwrap+=[
set whichwrap+=]
"保持光标行居中"
set scrolloff=1024
"不自动换行"
set nowrap
set backspace=2
" 显示中文帮助"
if version >= 603
set helplang=cn
set encoding=utf-8
endif
"编码"
set fencs=utf-8
set termencoding=utf-8
set encoding=utf-8
set fileencoding=utf-8
"配色"
colorscheme ron
"colorscheme elflord"
"colorscheme zellner"
"colorscheme slate"
"colorscheme pablo"
"--------键盘映射--------"
"从普通模式Esc进入插入模式,副作用是默认进入插入模式,引起小BUG"
"nnoremap <Esc> i"
"永远不进入普通模式,引起严重BUG"
"inoremap <Esc> <c-o>"
"撤销"
inoremap <c-z> <c-o>u
nnoremap <c-z> ui
vnoremap <c-z> <Esc><c-o>u
"反撤销"
inoremap <c-y> <c-o><c-r>
nnoremap <c-y> <c-r>i
vnoremap <c-y> <Esc><c-o><c-r>
"保存"
inoremap <c-s> <c-o>:w<CR>
nnoremap <c-s> :w<CR>i
vnoremap <c-s> <Esc><c-o>:w<CR>
"新标签"
inoremap <c-n> <c-o>:tabnew<CR>
nnoremap <c-n> :tabnew<CR>i
vnoremap <c-n> <Esc><c-o>:tabnew<CR>
"退出/关闭标签"
inoremap <c-w> <c-o>:q<CR>
nnoremap <c-w> :q<CR>i
vnoremap <c-w> <Esc><c-o>:q<CR>
"强行退出"
inoremap <c-q> <c-o>:q!<CR>
nnoremap <c-q> :q!<CR>i
vnoremap <c-q> <Esc><c-o>:q!<CR>
"粘贴"
inoremap <c-v> <Esc>pi
nnoremap <c-v> pi
vnoremap <c-v> <Delete><Esc>p
"删除整行"
inoremap <c-d> <c-o>dd
nnoremap <c-d> ddi
vnoremap <c-d> ddd
"输入命令"
inoremap <c-b> <c-o>:
"查找"
inoremap <c-f> <c-o>/
nnoremap <c-f> /
"替换"
inoremap <c-h> <c-o>:%s /
nnoremap <c-h> i<c-o>:%s /
"普通模式BackSpace,Delete进入插入模式"
nnoremap <Bs> i<Bs>
nnoremap <Delete> i<Delete>
"智能Home"
inoremap <home> <c-o>^
"Shift移动进入VSUAL模式"
inoremap <s-left> <c-o>v<left>
inoremap <s-right> <c-o>v<right>
inoremap <c-s-left> <c-o>v<c-left>
inoremap <c-s-right> <c-o>v<c-right>
inoremap <s-up> <c-o>v<up>
inoremap <s-down> <c-o>v<down>
inoremap <s-home> <c-o>v^
inoremap <s-end> <c-o>v<end>
inoremap <s-pageup> <c-o>v<pageup>
inoremap <s-pagedown> <c-o>v<pagedown>
"普通模式移动进入插入模式(只读文件无法移动)"
nnoremap <left> i<left>
nnoremap <right> i<right>
nnoremap <c-left> i<c-left>
nnoremap <c-right> i<c-right>
"nnoremap <up> i<up>"
"nnoremap <down> i<down>"
nnoremap <home> i<home>
nnoremap <end> i<end>
nnoremap <pageup> i<pageup>
nnoremap <pagedown> i<pagedown>
"普通模式Shift移动先进入插入模式再进入VSUAL模式"
nnoremap <s-left> i<c-o>v<left>
nnoremap <s-right> i<c-o>v<right>
nnoremap <c-s-left> i<c-o>v<c-left>
nnoremap <c-s-right> i<c-o>v<c-right>
nnoremap <s-up> i<c-o>v<up>
nnoremap <s-down> i<c-o>v<down>
nnoremap <s-home> i<c-o>v<home>
nnoremap <s-end> i<c-o>v<end>
nnoremap <s-pageup> i<c-o>v<pageup>
nnoremap <s-pagedown> i<c-o>v<pagedown>
"VSUAL模式使用Shift移动"
vnoremap <s-left> <left>
vnoremap <s-right> <right>
vnoremap <c-s-left> <c-left>
vnoremap <c-s-right> <c-right>
vnoremap <s-up> <up>
vnoremap <s-down> <down>
vnoremap <s-home> <home>
vnoremap <s-end> <end>
vnoremap <s-pageup> <pageup>
vnoremap <s-pagedown> <pagedown>
"VSUAL模式移动将回到INSERT模式"
vnoremap <left> <Esc><left>
vnoremap <right> <Esc><right>
vnoremap <c-left> <Esc><c-left>
vnoremap <c-right> <Esc><c-right>
vnoremap <up> <Esc><up>
vnoremap <down> <Esc><down>
vnoremap <home> <Esc><home>
vnoremap <end> <Esc><end>
vnoremap <pageup> <Esc><pageup>
vnoremap <pagedown> <Esc><pagedown>
"VSUAL模式 Backspace键删除"
vnoremap <Bs> <Delete>
vnoremap <c-c> y
inoremap <c-up> <up><up><up><up>
inoremap <c-down> <down><down><down><down>
vnoremap <c-up> <up><up><up><up>
vnoremap <c-down> <down><down><down><down>
vnoremap ( di(i<left><c-o>pi)<left>
vnoremap [ di[i<left><c-o>pi]<left>
vnoremap { di{i<left><c-o>pi}<left>
vnoremap ' di'i<left><c-o>pi'<left>
vnoremap " di"i<left><c-o>pi"<left>
"括号补全"
"inoremap ( ()<Left>
"inoremap [ []<Left>
"inoremap { {}<Left>
"inoremap ' ''<Left>
"inoremap " ""<Left>
"普通模式键盘输入字符进入插入模式"
nnoremap 0 i0
nnoremap 1 i1
nnoremap 2 i2
nnoremap 3 i3
nnoremap 4 i4
nnoremap 5 i5
nnoremap 6 i6
nnoremap 7 i7
nnoremap 8 i8
nnoremap 9 i9
nnoremap a ia
nnoremap b ib
nnoremap c ic
nnoremap d id
nnoremap e ie
nnoremap f if
nnoremap g ig
nnoremap h ih
nnoremap i ii
nnoremap j ij
nnoremap k ik
nnoremap l il
nnoremap m im
nnoremap n in
nnoremap o io
nnoremap p ip
nnoremap q iq
nnoremap r ir
nnoremap s is
nnoremap t it
nnoremap u iu
nnoremap v iv
nnoremap w iw
nnoremap x ix
nnoremap y iy
nnoremap z iz
nnoremap A iA
nnoremap B iB
nnoremap C iC
nnoremap D iD
nnoremap E iE
nnoremap F iF
nnoremap G iG
nnoremap H iH
nnoremap I iI
nnoremap J iJ
nnoremap K iK
nnoremap L iL
nnoremap M iM
nnoremap N iN
nnoremap O iO
nnoremap P iP
nnoremap Q iQ
nnoremap R iR
nnoremap S iS
nnoremap T iT
nnoremap U iU
nnoremap V iV
nnoremap W iW
nnoremap X iX
nnoremap Y iY
nnoremap Z iZ
nnoremap . i.
nnoremap , i,
nnoremap ; i;
nnoremap ! i!
nnoremap ? i?
"nnoremap : i:"
nnoremap ' i'
nnoremap " i"
nnoremap / i/
nnoremap \ i\
nnoremap $ i$
nnoremap % i%
nnoremap - i-
nnoremap _ i_
nnoremap ( i(
nnoremap ) i)
nnoremap { i{
nnoremap } i}
nnoremap < i<
nnoremap > i>
nnoremap [ i[
nnoremap ] i]
nnoremap = i=
nnoremap @ i@
nnoremap * i*
nnoremap ^ i^
nnoremap & i&
"nnoremap | i|"
nnoremap + i+
nnoremap # i#
nnoremap ` i`
nnoremap ~ i~
nnoremap <Space> i<Space>
nnoremap <Enter> i<Enter>
nnoremap <Tab> i<Tab>
"VSUAL模式键盘输入字符替换选中部分"
vnoremap 0 <Delete>i0
vnoremap 1 <Delete>i1
vnoremap 2 <Delete>i2
vnoremap 3 <Delete>i3
vnoremap 4 <Delete>i4
vnoremap 5 <Delete>i5
vnoremap 6 <Delete>i6
vnoremap 7 <Delete>i7
vnoremap 8 <Delete>i8
vnoremap 9 <Delete>i9
vnoremap a <Delete>ia
vnoremap b <Delete>ib
vnoremap c <Delete>ic
vnoremap d <Delete>id
vnoremap e <Delete>ie
vnoremap f <Delete>if
vnoremap g <Delete>ig
vnoremap h <Delete>ih
vnoremap i <Delete>ii
vnoremap j <Delete>ij
vnoremap k <Delete>ik
vnoremap l <Delete>il
vnoremap m <Delete>im
vnoremap n <Delete>in
vnoremap o <Delete>io
vnoremap p <Delete>ip
vnoremap q <Delete>iq
vnoremap r <Delete>ir
vnoremap s <Delete>is
vnoremap t <Delete>it
vnoremap u <Delete>iu
vnoremap v <Delete>iv
vnoremap w <Delete>iw
vnoremap x <Delete>ix
vnoremap y <Delete>iy
vnoremap z <Delete>iz
vnoremap A <Delete>iA
vnoremap B <Delete>iB
vnoremap C <Delete>iC
vnoremap D <Delete>iD
vnoremap E <Delete>iE
vnoremap F <Delete>iF
vnoremap G <Delete>iG
vnoremap H <Delete>iH
vnoremap I <Delete>iI
vnoremap J <Delete>iJ
vnoremap K <Delete>iK
vnoremap L <Delete>iL
vnoremap M <Delete>iM
vnoremap N <Delete>iN
vnoremap O <Delete>iO
vnoremap P <Delete>iP
vnoremap Q <Delete>iQ
vnoremap R <Delete>iR
vnoremap S <Delete>iS
vnoremap T <Delete>iT
vnoremap U <Delete>iU
vnoremap V <Delete>iV
vnoremap W <Delete>iW
vnoremap X <Delete>iX
vnoremap Y <Delete>iY
vnoremap Z <Delete>iZ
vnoremap . <Delete>i.
vnoremap , <Delete>i,
vnoremap ; <Delete>i;
vnoremap ! <Delete>i!
vnoremap ? <Delete>i?
"vnoremap : i<Delete>i"
vnoremap ' <Delete>i'
vnoremap " <Delete>i"
vnoremap / <Delete>i/
vnoremap \ <Delete>i\
vnoremap $ <Delete>i$
vnoremap % <Delete>i%
vnoremap - <Delete>i-
vnoremap _ <Delete>i_
vnoremap ( <Delete>i(
vnoremap ) <Delete>i)
vnoremap { <Delete>i{
vnoremap } <Delete>i}
vnoremap < <Delete>i<
vnoremap > <Delete>i>
vnoremap [ <Delete>i[
vnoremap ] <Delete>i]
vnoremap = <Delete>i=
vnoremap @ <Delete>i@
vnoremap * <Delete>i*
vnoremap ^ <Delete>i^
vnoremap & <Delete>i&
"vnoremap | i<Delete>i"
vnoremap + <Delete>i+
vnoremap # <Delete>i#
vnoremap ` <Delete>i`
vnoremap ~ <Delete>i~
vnoremap <Space> <Delete>i<Space>
vnoremap <Enter> <Delete>i<Enter>
vnoremap <Tab> >>
vnoremap <s-Tab> <<