My favorites
▼
|
Sign in
yy-vimscript
My Vim scripts, e.g. .vimrc, .ctags, colorscheme, snippets
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
vimrc
‹r32
r33
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer: Dexter.Yy <dexter.yy at gmail.com>
" Last Change: $LastChangedDate$ $Rev$
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" default
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
set history=400
if has('mouse')
set mouse=a
endif
set backspace=indent,eol,start
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
map Q gq
inoremap <C-U> <C-G>u<C-U>
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if has("autocmd")
filetype plugin indent on
augroup vimrcEx
au!
autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Platform
function! MySys()
if has("win32") || has("win64")
return "windows"
elseif has("mac")
return "mac"
else
return "linux"
endif
endfunction
"if MySys() == 'mac' || MySys() == 'linux'
"set shell=/bin/bash\ -l
"endif
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
" Move Backup Files to ~/.vim/backups/
set backupdir=~/.vim/backups
set dir=~/.vim/backups
set nobackup
"set nowritebackup
set shiftwidth=4
set tabstop=4
set nowrap
set wildmenu
set matchpairs=(:),{:},[:],<:>
set whichwrap=b,s,<,>,[,]
set foldmethod=indent
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("gui_running") || has("gui_macvim")
colorscheme yytextmate
let g:colors_name="yytextmate"
else
colorscheme slate
endif
if MySys() == "mac"
set guifont=TextMate_Regular:h13
set guifontwide=Hei_Regular:h13
elseif MySys() == "linux"
set guifont=Monospace
endif
set anti
set linespace=2
set number
set numberwidth=4
set equalalways
set guitablabel=%t
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" filetype and syntax
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:javascript_enable_domhtmlcss=1
let g:xml_use_xhtml = 1 "for xml.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MacVim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("gui_macvim")
set columns=171
set lines=58
winpos 52 42
let macvim_skip_cmd_opt_movement = 1
let macvim_hig_shift_movement = 1
set transparency=8
set guioptions-=T "egmrt
"set guioptions+=b
macm File.New\ Tab key=<D-T>
macm File.Save<Tab>:w key=<D-s>
macm File.Save\ As\.\.\.<Tab>:sav key=<D-S>
macm Edit.Undo<Tab>u key=<D-z> action=undo:
macm Edit.Redo<Tab>^R key=<D-Z> action=redo:
macm Edit.Cut<Tab>"+x key=<D-x> action=cut:
macm Edit.Copy<Tab>"+y key=<D-c> action=copy:
macm Edit.Paste<Tab>"+gP key=<D-v> action=paste:
macm Edit.Select\ All<Tab>ggVG key=<D-A> action=selectAll:
macm Window.Toggle\ Full\ Screen\ Mode key=<D-F>
macm Window.Select\ Next\ Tab key=<D-}>
macm Window.Select\ Previous\ Tab key=<D-{>
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" autocmd
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd! bufwritepost .vimrc source ~/.vimrc
autocmd! bufwritepost vimrc source ~/.vimrc
let g:jslint_neverAutoRun=1
autocmd BufRead * :lcd! %:p:h
" filetype
autocmd BufNewFile,BufRead *.vm setlocal ft=html
" language support
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=79
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" for AutoComplPop
autocmd FileType html setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" commands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! GetMySession(spath, ssname)
if a:ssname == 0
let a:sname = ""
else
let a:sname = "-".a:ssname
endif
execute "source $".a:spath."/session".a:sname.".vim"
execute "rviminfo $".a:spath."/session".a:sname.".viminfo"
execute "echo \"Load Success\: $".a:spath."/session".a:sname.".vim\""
endfunction
function! SetMySession(spath, ssname)
if a:ssname == 0
let a:sname = ""
else
let a:sname = "-".a:ssname
endif
execute "cd $".a:spath
execute "mksession! $".a:spath."/session".a:sname.".vim"
execute "wviminfo! $".a:spath."/session".a:sname.".viminfo"
execute "echo \"Save Success\: $".a:spath."/session".a:sname.".vim\""
endfunction
" load session from path
command! -nargs=+ LOAD call GetMySession(<f-args>)
" save session
command! -nargs=+ SAVE call SetMySession(<f-args>)
" for make & debug
function! QFSwitch() " toggle quickfix window
redir => ls_output
execute ':silent! ls'
redir END
let exists = match(ls_output, "[Quickfix List")
if exists == -1
execute ':copen'
else
execute ':cclose'
endif
endfunction
function! MyMake()
exe 'call ' . b:myMake . '()'
endfunction
function! MyLint()
exe 'call ' . b:myLint . '()'
endfunction
function! MyDebug()
exe 'call ' . b:myDebug . '()'
endfunction
function! MySetBreakPoint()
exe 'call ' . b:mySetBreakPoint . '()'
endfunction
function! MySetLog()
exe 'call ' . b:mySetLog. '()'
endfunction
function! MyRemoveBreakPoint()
exe 'call ' . b:myRemoveBreakPoint . '()'
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" map
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader=","
let g:mapleader=","
map <silent> <leader>rc :tabe ~/.vim/vimrc<cr>
map <leader>q :q<cr>
" for make & debug
noremap <F2> <ESC>:call MyLint()<CR>
noremap <F3> :call MyDebug()<CR>
noremap <F4> :call MyMake()<CR>
noremap <F5> <ESC>:call QFSwitch()<CR>
noremap <F6> :call MySetBreakPoint()<CR>
noremap <F7> :call MySetLog()<CR>
noremap <F8> :call MyRemoveBreakPoint()<CR>
nmap <tab> v>
nmap <s-tab> v<
vmap <tab> >gv
vmap <s-tab> <gv
" map cmd to ctrl
if MySys() == "mac"
map <D-y> <C-y>
map <D-e> <C-e>
map <D-f> <C-f>
map <D-b> <C-b>
map <D-u> <C-u>
map <D-d> <C-d>
map <D-w> <C-w>
map <D-r> <C-r>
map <D-o> <C-o>
map <D-i> <C-i>
map <D-g> <C-g>
map <D-a> <C-a>
map <D-]> <C-]>
cmap <D-d> <C-d>
imap <D-e> <C-e>
imap <D-y> <C-y>
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugin setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" bufExplorer setting
let g:bufExplorerSortBy='mru'
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitVertical=1 " Split vertically.
let g:bufExplorerSplitVertSize = 30 " Split width
let g:bufExplorerUseCurrentWindow=1 " Open in new window.
let g:bufExplorerMaxHeight=25
let g:bufExplorerResize=1
"autocmd BufWinEnter \[Buf\ List\] setl nonumber
" 默认键映射 <leader>bv :VSBufExplorer
"
" tasklist
nmap <silent> <leader>tl :TaskList<CR>
" taglists setting
nmap <silent> <leader>tg :TlistToggle<CR>
"let Tlist_Use_SingleClick=1
"Tlist_Process_File_Always=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Show_Menu=1
let Tlist_GainFocus_On_ToggleOpen=1
let Tlist_Close_OnSelect=1
let Tlist_Compact_Format=1
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 30
let Tlist_Inc_Winwidth = 0
let g:tlist_javascript_settings = 'javascript;f:function;c:class;o:object;m:method;s:string;a:array;n:constant'
" winManager setting
"let g:winManagerWindowLayout="BufExplorer,FileExplorer|taglist"
"let g:winManagerWidth = 30
"let g:defaultExplorer = 0
"nmap <silent> <leader>wm :WMToggle<cr>
" netrw setting
let g:netrw_winsize = 30
"nmap <silent> <leader>fe :Sexplore!<cr>
" NERDTree setting
nmap <silent> <leader>nt :NERDTree<cr>
" Most Recently Used (MRU)
nmap <silent> <leader>r :MRU<cr>
" FuzzyFinder setting
"nmap <leader>fb :FuzzyFinderBuffer<cr>
"nmap <leader>ff :FuzzyFinderFile<cr>
"nmap <leader>fd :FuzzyFinderDir<cr>
"nmap <leader>fe :FuzzyFinderMruFile<cr>
"nmap <leader>fc :FuzzyFinderMruCmd<cr>
"nmap <leader>fm :FuzzyFinderBookmark<cr>
""nmap <leader>ft :FuzzyFinderTag<cr>
"nmap <leader>ft :FuzzyFinderTaggedFile<cr>
nmap <leader>fb :FufBuffer<cr>
nmap <leader>ff :FufFile<cr>
nmap <leader>fd :FufDir<cr>
nmap <leader>fa :FufBookmark<cr>
"let NERDCreateDefaultMappings=0
let NERDShutUp=1
let g:NERDCommenterLeader="<leader>n" " change NERD_commenter.vim
let VCSCommandSVKExec='disabled no such executable'
" Use neocomplcache.
"let g:NeoComplCache_EnableAtStartup = 1
"" Use smartcase.
"let g:NeoComplCache_SmartCase = 1
"" Use camel case completion.
"let g:NeoComplCache_EnableCamelCaseCompletion = 1
"" Use underbar completion.
"let g:NeoComplCache_EnableUnderbarCompletion = 1
Show details
Hide details
Change log
r33
by dexter.yy on Apr 3, 2010
Diff
update
Go to:
/trunk/colors/yytextmate.vim
/trunk/doc/ack.txt
/trunk/doc/surround.txt
/trunk/doc/tags
/trunk/doc/tags-ja
/trunk/ftplugin/html.vim
...plugin/html/html_snip_helper.vim
/trunk/plugin/ack.vim
/trunk/plugin/matrix.vim
/trunk/plugin/snipMate.vim
/trunk/plugin/surround.vim
/trunk/syntax/javascript.vim
/trunk/syntax/python.vim
/trunk/vimrc
Sign in
to write a code review
Older revisions
r32
by dexter.yy on Apr 3, 2010
Diff
fix
r31
by dexter.yy on Apr 3, 2010
Diff
set directory
r28
by dexter.yy on Mar 17, 2010
Diff
<leader>rc
All revisions of this file
File info
Size: 9233 bytes, 370 lines
View raw file
File properties
svn:keywords
Rev LastChangedDate Author
Powered by
Google Project Hosting