-
Notifications
You must be signed in to change notification settings - Fork 3
/
vimrc_PublicEnv
443 lines (401 loc) · 15.3 KB
/
vimrc_PublicEnv
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
" =============================================================================
" FileName: vimrc_PublicEnv
" Desc:
" Author: Marslo
" Email: marslo.jiao@gmail.com
" Created: 2013-10-16 07:19:00
" Version: 0.0.9
" LastChange: 2014-09-16 04:43:23
" =============================================================================
let &runtimepath=printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM)
let s:portable = expand('<sfile>:p:h')
let &runtimepath=printf('%s/.vim,%s/.vim,%s/.vim/after', s:portable, &runtimepath, s:portable)
let bud=expand('$HOME/.marslo/.vim/bundle')
" let s:portable = '$HOME/Marslo'
" let $runtimepath=~s:portable/.vim,usr/local/share/vim/vimfiles,/usr/local/share/vim/vim74,/usr/local/share/vim/vimfiles/after,/home/auto/.vim/after
set nocompatible
syntax enable on
filetype plugin indent on
set history=500
set diffopt=filler,context:3
runtime macros/matchit.vim
set wrap " Wrap lines
set fileformat=unix
set viminfo=%,<800,'10,/50,:100,h,f0,n~/.marslo/.vim/cache/.viminfo
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
set tags=./tags
" ====================================== For Property =====================================
let mapleader=","
let g:mapleader=","
" Vim Bundle
filetype off
let &runtimepath .= ',' . expand(bud . '/vundle')
call vundle#begin(bud)
Bundle 'gmarik/vundle'
Bundle 'Yggdroot/indentLine'
Bundle 'kien/ctrlp.vim.git'
Bundle 'sjl/gundo.vim'
Bundle 'majutsushi/tagbar'
Bundle 'dantezhu/authorinfo'
Bundle 'Marslo/EnhCommentify.vim'
Bundle 'tpope/vim-pathogen'
Bundle 'gregsexton/MatchTag'
Bundle 'ervandew/supertab'
Bundle 'Marslo/auto-pairs'
Bundle 'Marslo/snipmate.vim.git'
Bundle 'yegappan/mru'
Bundle 'Conque-Shell'
Bundle 'taglist.vim'
Bundle 'winmanager'
" For Moving faster
Bundle 'rhysd/accelerated-jk'
" Bundle 'yonchu/accelerated-smooth-scroll'
" For Loading my function after vim start (reduce vim start time)
Bundle 'Marslo/MarsloFunc'
" For Groovy
Bundle 'groovy.vim--Ruley'
" Bundle 'mwaisgold/groovy-vim-files'
" For Python
" Bundle 'python-mode'
Bundle 'python_fold'
" Bundle 'kevinw/pyflakes-vim'
Bundle 'pyflakes/pyflakes'
Bundle 'python_match.vim'
Bundle 'Marslo/python-syntax'
Bundle 'tarmack/vim-python-ftplugin'
" For ruby
Bundle 'tpope/vim-rails'
Bundle 'vim-ruby/vim-ruby'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'kana/vim-textobj-user'
Bundle 'ruby-matchit'
" For Javascript
Bundle 'pangloss/vim-javascript'
Bundle 'jelera/vim-javascript-syntax'
" For AngularJS
Bundle 'burnettk/vim-angular'
" For web design
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
" Colors and themes and syntax
Bundle 'luochen1990/rainbow'
Bundle 'txt.vim'
Bundle 'hail2u/vim-css3-syntax'
Bundle 'Marslo/vim-coloresque'
Bundle 'Marslo/marslo.vim'
Bundle 'Marslo/MarsloVimOthers'
Bundle 'plasticboy/vim-markdown.git'
call vundle#end()
call pathogen#infect()
filetype plugin indent on
" ====================================== For My Function =====================================
function! GetVundle() " GetVundle() inspired by: http://pastebin.com/embed_iframe.php?i=C9fUE0M3
let vundleAlreadyExists=1
let bud='~/.marslo/.vim/bundle'
let vud=bud . '/vundle'
let vudcfg=expand(vud . '/.git/config')
if filereadable(vudcfg)
echo "Vundle has existed at " . expand(vud)
else
echo "Installing Vundle..."
echo ""
if isdirectory(expand(bud)) == 0
call mkdir(expand(bud), 'p')
endif
execute 'silent !git clone https://github.com/gmarik/vundle.git "' . expand(vud) . '"'
let vundleAlreadyExists=0
endif
endfunction
command! GetVundle :call GetVundle()
if isdirectory(expand(bud . '\MarsloFunc'))
command! GetVim :call marslofunc#GetVim()<CR>
nmap cmd :call marslofunc#OpenCMD()<CR>
nmap gf :call marslofunc#GotoFile()<CR>
xnoremap * :<C-u>call marslofunc#VSetSearch()<CR>/<C-R>=@/<CR><CR>
xnoremap # :<C-u>call marslofunc#VSetSearch()<CR>?<C-R>=@/<CR><CR>
map <M-o> :call marslofunc#OpenFoler()<CR>
nmap <F12> :call marslofunc#UpdateTags()<CR>
nmap <C-F5> :call marslofunc#RunResult()<CR>
nmap <leader>ti :call marslofunc#callit()<CR>
augroup resCur
autocmd!
autocmd BufWinEnter * call marslofunc#ResCur()
augroup END
" command! DiffSaved :call marslofunc#DiffWithSaved()<CR>
" nnoremap <leader>df :call marslofunc#DiffWithSaved()<CR>
set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
" set foldtext=marslofund#MyFoldText()<CR>
endif
" ====================================== For Programming =====================================
" Programming configs for Ruby and Rails
if has("autocmd")
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby let g:rubycomplete_buffer_loading=1
autocmd FileType ruby let g:rubycomplete_classes_in_global=1
augroup filetypedetect " Inspired from :h new-filetype
au BufNewFile,BufRead *.r.erb set filetype=r.ruby
augroup end
autocmd FileType ruby compiler ruby
endif
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
" Programming configs for Python
if has("autocmd")
au FileType python syn keyword pythonDecorator print self
au FileType python set tabstop=2 softtabstop=2 shiftwidth=2
au FileTYpe python set isk-=.
endif
let python_highlight_all = 1 " syntax-python
if !has('python')
let g:pymode = 0
endif
if isdirectory(expand(bud . '\python-mode'))
let g:pymode_lint_checker = ['pyflakes']
let g:pymode_trim_whitespace = 0
let g:pymode_options = 0
let g:pymode_rope = 0
endif
" Programming configs for Groovy
if has("autocmd")
au FileType groovy set tabstop=2 softtabstop=2 shiftwidth=2
endif
" ====================================== For Inteface =====================================
if 'xterm-256color' == $TERM
set t_Co=256
colorscheme marslo
let psc_style='cool'
else
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
colorscheme marslo16
endif
nmap <leader>v :e $HOME/.marslo/.vimrc<CR>
autocmd! bufwritepost $HOME/.marslo/.vimrc silent! source %
set iskeyword-=.
set autochdir
set fileencodings=utf-8,ucs-bom,gbk,cp936,gb2312,gb18030 " Code Format
set termencoding=utf-8
set encoding=utf-8 " Input Chinese (=cp936)
set fileencoding=utf-8
let &termencoding=&encoding
set nobackup noswapfile nowritebackup
set number " number: line number
set report=0
set autoread " Set auto read when a file is changed by outside
set showmatch " Show matching bracets (shortly jump to the other bracets)
set matchtime=1 " The shortly time
set tabstop=2 " Tab width
set softtabstop=2 " Width for backspace
set shiftwidth=2 " the tab width by using >> & <<
set autoindent expandtab
set smartindent
set smarttab " smarttab: the width of <Tab> in first line would refer to 'Shiftwidth' parameter
set linebreak
set tw=0
set modifiable
set write
set incsearch hlsearch ignorecase smartcase " Search
set magic " Regular Expression
set linespace=0
set wildmenu
set wildmode=longest,list,full " Completion mode that is used for the character
set noerrorbells novisualbell " turn off error beep/flash
set t_vb=
set list listchars=tab:\ \ ,trail:·,extends:»,precedes:«,nbsp:·
set cursorline " Highlight the current line
set scrolloff=3 " Scroll settings
set sidescroll=1
set sidescrolloff=5
set imcmdline " Fix context menu messing
set completeopt=longest,menuone " Supper Tab
set foldenable " Enable Fold
set foldcolumn=1
set foldexpr=1 " Shown line number after fold
set foldlevel=100 " Not fold while VIM set up
set viewoptions=folds
set backspace=indent,eol,start " make backspace h, l, etc wrap to
set whichwrap+=<,>,h,l
set go+=a " Visual selection automatically copied to the clipboard
set hidden " Switch between buffers with unsaved change
set equalalways
set formatoptions=tcrqn
set formatoptions+=B " Remove the backspace for combine lines (Only for chinese)
set matchpairs+=<:>
set noendofline
if has('cmdline_info')
set ruler " ruler: Show Line and colum number
set showcmd " Show (partial) command in status line
endif
if has('statusline')
set laststatus=2 " Set status bar
set statusline=%#User2#%m%r%*\ %F\ %y,%{&fileformat}
set statusline+=%=\ %-{strftime(\"%H:%M\ %d/%m/%Y\")}\ %b[A],0x%B\ %c%V,%l/%L\ %1*--%n%%--%*\ %p%%\ |
endif
" set synmaxcol=128
" set binary
" set cryptmethod=blowfish
if has('persistent_undo')
set noundofile
endif
noremap <F1> <ESC>
imap <F1> <ESC>a
nnoremap j gj
nnoremap gj j
nnoremap k gk
nnoremap gk k
nnoremap n nzzzv
nnoremap N Nzzzv
map ,bd :bd<CR>
map <C-k> <C-w>k
map <C-j> <C-w>j
map <C-a> <ESC>^
imap <C-a> <ESC>I
cnoremap <C-a> <Home>
map <C-e> <ESC>$
imap <C-e> <ESC>A
cnoremap <C-e> <End>
inoremap <A-f> <ESC><Space>Wi
cnoremap <A-f> <S-Right>
inoremap <A-b> <ESC>Bi
cnoremap <A-b> <S-Left>
inoremap <A-d> <ESC>lcW
inoremap <C-d> <Del>
nnoremap Y y$
nnoremap <Del> "_x
xnoremap <Del> "_d
" nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
nnoremap <space> za
nnoremap & :&&<CR>
xnoremap & :&&<CR>
vmap s <Plug>VSurround
inoremap <leader>tt <C-R>=strftime("%d/%m/%y %H:%M:%S")<cr>
inoremap <leader>fn <C-R>=expand("%:t:r")<CR>
inoremap <leader>fe <C-R>=expand("%:t")<CR>
inoremap <leader>w <C-O>:w<CR>
nnoremap zdb :%s/\s\+$//<CR>
nnoremap zhh :%s/^\s\+//<CR>
nnoremap zmm :g/^/ s//\=line('.').' '/<CR>
nnoremap zws :g/^\s*$/d<CR>
nnoremap zdm :%s/<C-v><CR>//ge<CR>
nnoremap zng :%s///gn<CR>
if version > 703
" autocmd FocusLost * set norelativenumber
autocmd FocusGained * set relativenumber
autocmd InsertEnter * set norelativenumber
autocmd InsertLeave * set relativenumber
autocmd CmdwinEnter * set norelativenumber
autocmd CmdwinLeave * set relativenumber
autocmd CmdwinEnter * let b:ei_save = &eventignore | set eventignore=CursorHold,InsertEnter
autocmd CmdwinLeave * let &eventignore = b:ei_save
endif
iabbrev <leader>/* /*********************************
iabbrev <leader>*/ *********************************/
iabbrev <leader>#- #------------------
" ====================================== For Function =====================================
let g:ctrlp_map = '<c-p>' " CtrlP
let g:ctrlp_working_path_mode = 'ra' " Search parents as well (stop searching sartly)
let g:ctrlp_max_height = 8
let g:ctrlp_max_depth = 100
let g:ctrl_root_makers = ['.ctrlp'] " Stop search if these files present
let g:ctrlp_use_caching = 1
let g:ctrlp_clear_cache_on_exit = 0 " Cross session caching
let g:ctrlp_cache_dir = '$HOME/.vim/cache/ctrlp'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|rpm|tar|gz|bz2|zip|ctags|tags)|tags|ctags$',
\ 'link': 'some_bad_symbolic_links',
\ }
nmap <leader>tv :ConqueTermSplit bash <CR>
let g:winManagerWidth = 20
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap <leader>mm :WMToggle<cr>
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_SingleClick=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_GainFocus_On_ToggleOpen=1
let Tlist_show_Menu=1
let Tlist_sql_settings = 'sql;P:package;t:table'
let Tlist_Process_File_Always=0
nmap <leader>tl :TlistToggle<CR>
map <leader>ta :TagbarToggle<CR>
let g:tagbar_left=1
let g:tagbar_width=20
let g:tagbar_autofocus=1
let g:tagbar_expand=1
let g:tagbar_singleclick=1
let g:tagbar_iconchars=['+', '-']
let g:tagbar_autoshowtag=1
let g:tagbar_show_linenumbers=0
let g:EnhCommentifyAlignRight='Yes'
let g:EnhCommentifyRespectIndent='yes'
let g:EnhCommentifyPretty='Yes'
let g:EnhCommentifyMultiPartBlocks='Yes'
let g:EnhCommentifyUseSyntax='Yes'
map <leader>aid :AuthorInfoDetect<CR>
let g:vimrc_author='Marslo'
let g:vimrc_email='marslo.jiao@gmail.com'
au BufWritePre, FileWritePre * :AuthorInfoDetect<CR>
let MRU_Auto_Close = 1 " Most Recently Used(MRU)
let MRU_Max_Entries = 10
let MRU_Exclude_Files='^/tmp/.*\|^/temp/.*\|^/media/.*\|^/mnt/.*'
map <leader>re :MRU<CR>
noremap <Leader>u :GundoToggle<CR>
augroup vimrc
au BufReadPre * setlocal foldmethod=indent
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
augroup END
let g:rainbow_active = 1
let g:rainbow_operators = 1
let g:rainbow_conf = {
\ 'guifgs' : ['#6A5ACD', '#B22222', '#C0FF3E', '#EEC900', '#9A32CD', '#EE7600', '#98fb98', '#686868'],
\ 'ctermfgs' : 'xterm-256color' == $TERM ? ['141', '196', '112', '208', '129', '166', '85', '237'] : ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta'],
\ 'parentheses': [['(',')'], ['\[','\]'], ['{','}']],
\ 'separately': {
\ 'css': {
\ 'parentheses': [['(',')'], ['\[','\]']],
\ },
\ 'scss': {
\ 'parentheses': [['(',')'], ['\[','\]']],
\ },
\ 'html': {
\ 'parentheses': [['(',')'], ['\[','\]'], ['{','}']],
\ },
\ }
\}
let g:indentLine_color_gui = "#282828"
let g:indentLine_color_term = 239
let g:indentLine_indentLevel = 20
let g:indentLine_showFirstIndentLevel = 1
let g:indentLine_color_tty = 0
" let g:indentLine_faster = 1
if 'xterm-256color' == $TERM
let g:indentLine_char = '¦'
elseif has('win32')
let g:indentLine_color_term = 8
let g:indentLine_char = '|'
else
let g:indentLine_color_tty_dark = 0
let g:indentLine_char = '¦'
endif
let SuperTabDefaultCompletionType = '<c-p>'
let SuperTabMappingForward = '<c-p>'
let SuperTabMappingTabLiteral = '<Tab>'
let SuperTabClosePreviewOnPopupClose = 1
let g:AutoPairs = {'(':')', '[':']', '{':'}', '<':'>',"'":"'",'"':'"', '`':'`'}
let g:AutoPairsParens = {'(':')', '[':']', '{':'}', '<':'>'}
let g:AutoPairsFlyMode = 1
let g:AutoPairsShortcutBackInsert = '<M-b>'
match VendorPrefix /-\(moz\|webkit\|o\|ms\)-[a-zA-Z-]\+/ " For css3
" if isdirectory(bud . '\accelerated-jk')
" nmap j <Plug>(accelerated_jk_gj)
" nmap k <Plug>(accelerated_jk_gk)
" endif
autocmd BufWinLeave * silent! mkview
autocmd BufWinEnter * silent! loadview
autocmd BufRead,BufNewFile *.txt setfiletype txt
autocmd BufRead,BufNewFile *.t set ft=perl
autocmd FileType javascript syntax clear jsFuncBlock
" vim: tabstop=2:softtabstop=2:shiftwidth=2:expandtab