forked from Superjomn/home_config_backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc_park
382 lines (314 loc) · 9.37 KB
/
.vimrc_park
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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" NERD-tree
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'jeroenbourgois/vim-actionscript'
Plugin 'cespare/mxml.vim'
Plugin 'vim-scripts/xmledit'
Plugin 'msanders/cocoa.vim'
Plugin 'Yggdroot/indentLine'
Plugin 'tfnico/vim-gradle'
Plugin 'adragomir/javacomplete'
Plugin 'scrooloose/syntastic'
Plugin 'flazz/vim-colorschemes'
Plugin 'molok/vim-smartusline'
Plugin 'bpdp/vim-java'
Plugin 'mattn/emmet-vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"=============================================================================
" General settings
"=============================================================================
highlight OverLength ctermbg=blue ctermfg=white
set colorcolumn=120
set nocp
" Tab related
set ts=4
set sw=4
set smarttab
set et
set ambiwidth=double
" Format related
set tw=0
set lbr
set fo+=mB
" Indent related
set cin
set ai
set cino=:0g0t0(susj1
" Editing related
set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]
set mouse=
set selectmode=
set mousemodel=popup
set keymodel=
set selection=inclusive
" Misc
set wildmenu
set nospell
" Encoding related
set encoding=utf-8
"set langmenu=zh_CN.UTF-8
"language message zh_CN.UTF-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
" File type related
filetype plugin indent on
au BufRead *.as set filetype=actionscript et
au BufRead *.mxml set filetype=mxml et
au BufRead *.mml set filetype=mathml et
" Display related
set ru
set nu
set sm
set hls
set nowrap
syntax on
" Refer to: https://github.com/bpdp/vim-java
set ofu=syntaxcomplete#Complete
if (has("gui_running"))
colo bluegreen
else
colo bluegreen
endif
" Default Colors for CursorLine
highlight CursorLine ctermbg=Blue ctermfg=Yellow
" Change Color when entering Insert Mode
autocmd InsertEnter * highlight CursorLine ctermbg=Darkgray ctermfg=Red
"Revert Color to default when leaving Insert Mode
autocmd InsertLeave * highlight CursorLine ctermbg=Blue ctermfg=Yellow
" autocmd vimenter * NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
let g:NERDTreeDirArrows=0
let g:NERDTreeWinSize=30
au BufRead,BufNewFile *.gradle set filetype=groovy
" set foldmethod=indent
" set foldnestmax=2
let g:indentLine_leadingSpaceEnabled=1
let g:indentLine_leadingSpaceChar='.'
let g:indentLine_color_term=7
let g:indentLine_color_gui='#FFB3B3'
" let g:indentLine_char = '|'
hi Modified guifg=black guibg=#FFA500
set statusline=%2.2n\ %t\ %h%#Modified#%m%r%*%=%l%L\ %2c\ %P
let g:smartusline_string_to_highlight='%2.2n %t %h'
au BufNewFile,BufRead *.groovy setf groovy
au BufNewFile,BufRead *.gradle setf groovy
if (has("autocmd"))
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
" ============================================================================
" Shortcuts
" ============================================================================
" Escape arrow in putty
map <Esc>[A <C-Up>
map <Esc>[B <C-Down>
map <Esc>[C <C-Right>
map <Esc>[D <C-Left>
map! <Esc>[A <C-Up>
map! <Esc>[B <C-Down>
map! <Esc>[D <C-Left>
map! <Esc>[C <C-Right>
" Move lines
nmap <C-Down> :move .+1<CR>
nmap <C-Up> :move .-2<CR>
" Toggle line number
nmap <F12> :set nu!<CR>
imap <F12> :set nu!<CR>
" Toggle NERDTree window
nmap <silent> <F9> :NERDTreeToggle<CR>
nmap <silent> <C-O> :NERDTreeToggle<CR><ESC>
" miniBufExploer config
let g:miniBufExplMapWindowNavVim=1
let g:miniBufExplMapWindowNavArrows=1
let g:miniBufExplMapCTabSwitchBufs=1
let g:miniBufExplModSelTarget=1
" buffer change
nmap <S-Tab> :bn<CR>
nmap <S-Left> :bp<CR>
nmap <S-Right> :bn<CR>
" Toggle Tagbar
nmap <C-t> :TagbarToggle<CR>
"=============================================================================
" Modes
"=============================================================================
function EnglishMode()
"set imactivatekey=
"set noimcmdline
"set iminsert=0
"set imsearch=0
setlocal nospell
endfunction
command -nargs=0 EnglishMode call EnglishMode()
function ChineseMode()
"set imactivatekey=C-space
"set noimcmdline
"set iminsert=2
"set imsearch=2
setlocal nospell
endfunction
command -nargs=0 ChineseMode call ChineseMode()
function TextMode()
setlocal nocin
setlocal nosm
setlocal noai
setlocal tw=0
endfunction
command -nargs=0 TextMode call TextMode()
function CodeMode()
setlocal cin
setlocal sm
setlocal ai
setlocal tw=0
endfunction
command -nargs=0 CodeMode call CodeMode()
function MailMode()
call TextMode()
setlocal ft=mail
setlocal tw=0
endfunction
command -nargs=0 MailMode call MailMode()
function BBSMode()
call MailMode()
call ChineseMode()
setlocal ft=bbs
setlocal fenc=cp936
setlocal tw=0
endfunction
command -nargs=0 BBSMode call BBSMode()
function VikiMode()
call ChineseMode()
setlocal ft=viki
endfunction
command -nargs=0 VikiMode call VikiMode()
"=============================================================================
" Functions
"=============================================================================
function TimeStamp()
let curposn= SaveWinPosn()
%s/\$Date: .*\$/\=strftime("$Date: %Y-%m-%d %H:%M:%S$")/ge
%s/Last Change: .*$/\=strftime("Last Change: %Y-%m-%d %H:%M:%S")/ge
%s/Last Modified: .*$/\=strftime("Last Modified: %Y-%m-%d %H:%M:%S")/ge
" Replace once and never update.
%s/Created: *$/\=strftime("Created: %Y-%m-%d %H:%M:%S")/ge
call RestoreWinPosn(curposn)
endfunction
command -nargs=0 TimeStamp call TimeStamp()
function AutoTimeStamp()
augr tagdate
au!
au BufWritePre,FileWritePre * call TimeStamp()
augr END
endfunction
command -nargs=0 AutoTimeStamp call AutoTimeStamp()
function NoAutoTimeStamp()
augr tagdate
au!
augr END
endfunction
command -nargs=0 NoAutoTimeStamp call NoAutoTimeStamp()
command -nargs=1 Margin exec "match Error /.\\%>" . (<args> + 1) . "v/"
command -nargs=0 NoMargin match none
function CodeLayout()
call CodeMode()
WManager
Tlist
endfunction
command -nargs=0 CodeLayout call CodeLayout()
function CodeLayoutSmall()
call CodeLayout()
set columns=141
exec "norm \<c-w>l"
set nu
set lines=100
endfunction
command -nargs=0 CodeLayoutSmall call CodeLayoutSmall()
function CodeLayoutLarge()
call CodeLayout()
set columns=226
exec "norm \<c-w>l"
set nu
vsplit
set lines=100
endfunction
command -nargs=0 CodeLayoutLarge call CodeLayoutLarge()
" ============================================================================
" Plugins settings
" ============================================================================
" Tlist
let Tlist_Use_Right_Window=1
let Tlist_File_Fold_Auto_Close=1
" A
let g:alternateNoDefaultAlternate=1
let g:alternateRelativeFiles=1
" Viki
let g:vikiNameSuffix=".viki"
autocmd! BufRead,BufNewFile *.viki call VikiMode()
" BBS
autocmd! BufRead,BufNewFile *.bbs call BBSMode()
" Mail
autocmd! FileType mail call MailMode()
" XML
autocmd! FileType html,xml,yaml setlocal sw=2 ts=2
" FencView
let g:fencview_autodetect=0
"=============================================================================
" Platform dependent settings
"=============================================================================
if (has("win32"))
"-------------------------------------------------------------------------
" Win32
"-------------------------------------------------------------------------
if (has("gui_running"))
set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI
set guifontwide=NSimSun:h9:cGB2312
endif
" For Viki
let g:netrw_browsex_viewer="start"
" For tee
set shellpipe=2>&1\|\ tee
" VimTweak
if (has("gui_running"))
command -nargs=1 SetAlpha call libcallnr("vimtweak.dll",
\"SetAlpha", <args>)
command -nargs=0 TopMost call libcallnr("vimtweak.dll",
\"EnableTopMost", 1)
command -nargs=0 NoTopMost call libcallnr("vimtweak.dll",
\"EnableTopMost", 0)
endif
else
"-------------------------------------------------------------------------
" Linux
"-------------------------------------------------------------------------
if (has("gui_running"))
set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
endif
" For Viki
let g:vikiHomePage="~/document/Viki/index.viki"
let g:netrw_browsex_viewer="kfmclient exec"
set makeprg=build
endif