1
1
" ==========================================
2
2
" Author: ruanyl
3
- " Version: 0.9.1
4
- " Email: ruanyl@gmail.com
5
- " BlogPost: http://blog.bigruan.com
6
- " ReadMe: README.md
7
- " Last_modify: 2014-05-15
8
- " Sections:
9
- " ->General Settings
10
- " ->Show:User Interface settings
11
- " ->File encode:encode for varied filetype
12
- " ->Others
13
- " ->Hot Key:Customized keys
14
- " ->Bundle:Plgin management and setting
15
- " ->Color&Theme
3
+ " Version: 0.9.9
16
4
" ==========================================
17
5
6
+ set nocompatible
7
+
8
+ " Load plugins
9
+ if filereadable (expand (" ~/.vim/vimrc.bundles" ))
10
+ source ~/.vim/vimrc.bundles
11
+ endif
12
+
18
13
" ==========================================
19
14
" General Settings
20
15
" ==========================================
21
16
22
- set nocompatible " Do not compatible with VI
17
+ filetype plugin indent on
18
+ syntax enable
19
+ syntax on
23
20
24
- set history = 200 " history: number of command-lines remembered
21
+ colorscheme solarized
22
+ " colorscheme molokai
23
+ " colorscheme desert
25
24
25
+ set background = dark
26
+ set t_Co = 256
27
+ set history = 200 " history: number of command-lines remembered
26
28
set autoread " auto reload file after being modified
27
29
set shortmess = atI " do not show initial page
28
-
29
30
set nobackup
30
31
set noswapfile
31
-
32
32
set cursorcolumn " highlight current column
33
33
set cursorline " highlight current line
34
-
35
34
set t_ti = t_te = " alway show the content on the screen after exist VIM
36
- " in case if i did some stupid deleting, and i can find them back
37
-
38
35
set mouse -= a " disable mouse
39
-
40
36
set selection = inclusive " set selection=exclusive
41
37
set selectmode = mouse ,key
42
-
43
- " No annoying sound on errors
44
38
set title " change the terminal's title
45
39
set novisualbell " don't beep
46
40
set noerrorbells " don't beep
47
41
set t_vb =
48
42
set tm = 500
49
-
50
43
set nostartofline " keep cursor postion when switching between buffers
51
44
52
- " ==========================================
53
- " Show: User Interface settings
54
- " ==========================================
55
-
56
45
set number " show line number
57
46
set nowrap " disable wrap
58
47
@@ -82,13 +71,36 @@ set smarttab
82
71
set expandtab " when typing <Tab>, use <space> instead
83
72
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
84
73
85
- set showcmd " Show partial commands in status line and Selected characters/lines in visual mode
86
-
87
74
set hidden " A buffer becomes hidden when it is abandoned
88
75
set wildmode = longest:full,full
89
76
set ttyfast
90
77
91
- set relativenumber " show relative line number
78
+ set relativenumber " show relative line number
79
+ set ruler " show the current line number and column number
80
+ set showcmd " show the current typing command
81
+ set noshowmode " Show current mode
82
+ set scrolloff = 7 " Set 7 lines to the cursor - when moving vertically using j/k
83
+
84
+ " File encode:encode for varied filetype
85
+ set encoding = utf- 8
86
+ set fileencodings = ucs- bom,utf- 8 ,cp936,gb18030,big5,euc- jp,euc- kr,latin1
87
+ set helplang = en
88
+ set termencoding = utf- 8
89
+
90
+ set ffs = unix,dos,mac " Use Unix as the standard file type
91
+ set formatoptions += m
92
+ set formatoptions += B " When joining lines, don't insert a space between two multi-byte characters.
93
+ set completeopt = longest,menu " behaviour of insert mode completion
94
+ set wildmenu " auto complete command
95
+ set wildignore = ** .o ,* ~,.swp,* .bak,* .pyc,* .class " Ignore compiled files
96
+
97
+ set viminfo ^= % " Remember info about open buffers on close
98
+ set magic " For regular expressions turn magic on
99
+
100
+ set backspace = eol ,start ,indent " Configure backspace so it acts as it should act
101
+ set whichwrap += <,> ,h ,l
102
+ set pastetoggle = <F5> " when in insert mode, toggle between 'paste' and 'nopaste'
103
+
92
104
autocmd InsertEnter * :set norelativenumber " no relativenumber in insert mode
93
105
autocmd InsertLeave * :set relativenumber " show relativenumber when leave insert mode
94
106
@@ -100,10 +112,6 @@ if has('persistent_undo')
100
112
set undodir = ~/.undodir/
101
113
endif
102
114
103
- set ruler " show the current line number and column number
104
- set showcmd " show the current typing command
105
- set noshowmode " Show current mode
106
- set scrolloff = 7 " Set 7 lines to the cursor - when moving vertically using j/k
107
115
108
116
if has (' statusline' )
109
117
set laststatus = 2
@@ -115,34 +123,11 @@ if has('statusline')
115
123
set statusline += % = % -14 .(% l ,% c % V% )\ % p %% " Right aligned file nav info
116
124
endif
117
125
118
- " ==========================================
119
- " File encode:encode for varied filetype
120
- " ==========================================
121
-
122
- set encoding = utf- 8
123
- set fileencodings = ucs- bom,utf- 8 ,cp936,gb18030,big5,euc- jp,euc- kr,latin1
124
- set helplang = en
125
- set termencoding = utf- 8
126
-
127
- set ffs = unix,dos,mac " Use Unix as the standard file type
128
- set formatoptions += m
129
- set formatoptions += B " When joining lines, don't insert a space between two multi-byte characters.
130
- set completeopt = longest,menu " behaviour of insert mode completion
131
- set wildmenu " auto complete command
132
- set wildignore = ** .o ,* ~,.swp,* .bak,* .pyc,* .class " Ignore compiled files
133
126
134
- " if this not work ,make sure .viminfo is writable for you
135
- if has (" autocmd" ) " remember the last cursor postion when reopen a file
127
+ if has (" autocmd" )
136
128
au BufReadPost * if line (" '\" " ) > 1 && line (" '\" " ) <= line (" $" ) | exe " normal! g'\" " | endif
137
129
endif
138
- set viminfo ^= % " Remember info about open buffers on close
139
- set magic " For regular expressions turn magic on
140
-
141
- set backspace = eol ,start ,indent " Configure backspace so it acts as it should act
142
- set whichwrap += <,> ,h ,l
143
- set pastetoggle = <F5> " when in insert mode, toggle between 'paste' and 'nopaste'
144
- au InsertLeave * set nopaste " disbale paste mode when leaving insert mode
145
- autocmd ! bufwritepost .vimrc source $MYVIMRC " auto load vimrc file after modify
130
+ au InsertLeave * set nopaste
146
131
147
132
" close popup menu when leave insert mode
148
133
autocmd InsertLeave * if pumvisible () == 0 |pclose |endif
@@ -154,11 +139,11 @@ inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
154
139
autocmd FileType python set tabstop = 4 shiftwidth = 4 expandtab ai
155
140
autocmd FileType javascript,json,css,scss,html set tabstop = 2 shiftwidth = 2 expandtab ai
156
141
142
+ autocmd BufReadPre * if getfsize (expand (" %" )) > 10000000 | syntax off | endif
143
+
157
144
" ==========================================
158
145
" Key Mappings: Customized keys
159
146
" ==========================================
160
- let mapleader = ' ,'
161
- let g: mapleader = ' ,'
162
147
163
148
command ! W w ! sudo tee % > /dev/ null
164
149
@@ -175,10 +160,6 @@ vnoremap <C-c> "*y
175
160
" use <C-V> to paste yanked content
176
161
inoremap <C-V> <C-R> "
177
162
178
- " Quickly edit/reload the vimrc file
179
- nmap <silent> <leader> ev :e $MYVIMRC<CR>
180
- nmap <silent> <leader> sv :so $MYVIMRC<CR>
181
-
182
163
" Treat long lines as break lines (useful when moving around in them)
183
164
map j gj
184
165
map k gk
@@ -216,12 +197,6 @@ noremap <F1> <Esc>"
216
197
nnoremap ; :
217
198
nnoremap ' :b
218
199
219
- nnoremap <leader> v V`}
220
-
221
- " Use sane regexes !not used!
222
- nnoremap / /\v
223
- vnoremap / /\v
224
-
225
200
" Keep search pattern at the center of the screen."
226
201
nnoremap <silent> n nzz
227
202
nnoremap <silent> N Nzz
@@ -239,11 +214,6 @@ nnoremap U <C-r>
239
214
" select all
240
215
map <Leader> sa ggVG"
241
216
242
- cnoremap %% <C-R> =expand('%:h').'/'<cr>
243
- map <leader> ew :e %%
244
- map <leader> es :sp %%
245
- map <leader> ev :vsp %%
246
-
247
217
nnoremap dp :diffput<CR>
248
218
nnoremap dg :diffget<CR>
249
219
@@ -264,351 +234,7 @@ if has('macunix')
264
234
vmap <C-c> :w !pbcopy<CR><CR>
265
235
endif
266
236
267
- " ==========================================
268
- " Bundle: Plgin management and setting
269
- " ==========================================
270
- " package dependent: ctags
271
- " awesome javascript autocomplete dependent: nodejs
272
-
273
- call plug#begin (' ~/.vim/bundle' )
274
-
275
- " ################### Plugins Management ###################"
276
-
277
- " vim plugin bundle control, command model
278
- " :PlugInstall install
279
- " :PlugInstall! update
280
- " :PlugClean remove plugin not in list
281
-
282
- " ################### Navigation ###################"
283
- Plug ' scrooloose/nerdtree' , {' on' : ' NERDTreeToggle' }
284
- map <leader> e :NERDTreeToggle<CR>
285
- let NERDTreeHighlightCursorline= 1
286
- let NERDTreeQuitOnOpen= 1
287
- let NERDTreeIgnore= [ ' \.pyc$' , ' \.pyo$' , ' \.obj$' , ' \.o$' , ' \.so$' , ' \.egg$' , ' ^\.git$' , ' ^\.svn$' , ' ^\.hg$' ]
288
- let g: netrw_home= ' ~/bak'
289
- " close vim if the only window left open is a NERDTree
290
- autocmd bufenter * if (winnr (" $" ) == 1 && exists (" b:NERDTreeType" ) && b: NERDTreeType == " primary" ) | q | end
291
-
292
- Plug ' majutsushi/tagbar'
293
- nmap <F9> :TagbarToggle<CR>
294
- let g: tagbar_autofocus = 1
295
- let g: tagbar_width = 50
296
-
297
- Plug ' ctrlpvim/ctrlp.vim'
298
- map <leader> m :CtrlPMRU<CR>
299
- map <leader> b :CtrlPBuffer<CR>
300
- map <leader> f :CtrlPMixed<CR>
301
- let g: ctrlp_custom_ignore = {
302
- \ ' dir' : ' \v[\/](node_modules|target|dist)|\.(git|hg|svn|rvm)$' ,
303
- \ ' file' : ' \v\.(exe|so|dll|zip|tar|tar.gz)$' ,
304
- \ }
305
- let g: ctrlp_follow_symlinks= 1
306
-
307
- " CtrlP extensions, go to defination
308
- " Mapping: <Leader>fu
309
- Plug ' tacahiroy/ctrlp-funky'
310
- let g: ctrlp_funky_matchtype = ' path'
311
- nnoremap <Leader> fu :CtrlPFunky<Cr>
312
-
313
- Plug ' sgur/ctrlp-extensions.vim'
314
- nnoremap <Leader> cy :CtrlPYankring<Cr>
315
-
316
- Plug ' dyng/ctrlsf.vim' , {' on' : ' CtrlSFVwordExec' }
317
- vmap <Leader> s <Plug> CtrlSFVwordExec
318
-
319
- Plug ' rking/ag.vim'
320
- nnoremap <Leader> <Leader> a :Ag!<space>
321
- let g: ag_working_path_mode= ' r'
322
-
323
-
324
- " ################### Display Enhancements ###################"
325
- let g: netrw_liststyle= 3
326
- " Enhances status bar
327
- Plug ' bling/vim-airline'
328
- let g: airline_powerline_fonts = 1
329
- let g: airline #extensions#tabline #enabled = 1
330
- let g: airline #extensions#tabline #formatter = ' unique_tail'
331
- let g: airline #extensions#tabline #buffer_nr_show = 1
332
-
333
- " css/less/sass/html color preview
334
- Plug ' gorodinskiy/vim-coloresque'
335
-
336
- " show whitespaces not used and call :FixWhitespace to remove them
337
- " Mapping: <leader><space>
338
- Plug ' bronson/vim-trailing-whitespace'
339
- map <leader> <space> :FixWhitespace<cr>
340
-
341
- " Plug 'ruanyl/trailing-tab.vim'
342
- " let g:extra_tab_ignored_filetypes = ['php']
343
-
344
- " auto save views when exist vim
345
- " auto open views when open vim
346
- " this will create a `session` dir in your `.vim` dir
347
- Plug ' tpope/vim-obsession'
348
- Plug ' dhruvasagar/vim-prosession'
349
-
350
- Plug ' MattesGroeger/vim-bookmarks'
351
- nmap <Leader> <Leader> m <Plug> BookmarkToggle
352
- nmap <Leader> i <Plug> BookmarkAnnotate
353
- nmap <Leader> a <Plug> BookmarkShowAll
354
- nmap <Leader> j <Plug> BookmarkNext
355
- nmap <Leader> k <Plug> BookmarkPrev
356
- nmap <Leader> c <Plug> BookmarkClear
357
- nmap <Leader> x <Plug> BookmarkClearAll
358
-
359
- " highlights the enclosing html/xml tags
360
- Plug ' Valloric/MatchTagAlways'
361
-
362
- " Maximize split window
363
- Plug ' szw/vim-maximizer'
364
- nnoremap <tab> :MaximizerToggle<CR>
365
-
366
- " ################### Themes ###################"
367
-
368
- " theme solarized
369
- Plug ' altercation/vim-colors-solarized'
370
- let g: solarized_termcolors= 16
371
- let g: solarized_termtrans= 1
372
- let g: solarized_contrast= " high"
373
- let g: solarized_visibility= " high"
374
-
375
- " theme molokai
376
- Plug ' tomasr/molokai'
377
- " let g:molokai_original = 1
378
-
379
-
380
- " ################### fast move ###################"
381
-
382
- " Move to anywhere
383
- " Mapping: s
384
- Plug ' Lokaltog/vim-easymotion'
385
- map <space> <Plug> (easymotion-s2)
386
- map / <Plug> (easymotion-sn)
387
- omap / <Plug> (easymotion-tn)
388
- let g: EasyMotion_smartcase = 1
389
-
390
- " extended % matching for HTML, LaTeX, and many other languages
391
- Plug ' vim-scripts/matchit.zip'
392
-
393
- " ################### auto complete and fast edit ###################"
394
- " Select blocks quickly
395
- " Mapping: <Enter>
396
- Plug ' gcmt/wildfire.vim'
397
- let g: wildfire_objects = {
398
- \ " *" : [" i'" , ' i"' , " i)" , " i]" , " i}" , " ip" ],
399
- \ " html,xml" : [" at" ],
400
- \ }
401
- let g: wildfire_fuel_map = " <ENTER>"
402
- let g: wildfire_water_map = " <BS>"
403
-
404
- " auto close html tag when press >
405
- Plug ' alvan/vim-closetag'
406
-
407
- Plug ' Valloric/YouCompleteMe'
408
- let g: ycm_autoclose_preview_window_after_completion = 1
409
- " let g:ycm_complete_in_strings = 1
410
- let g: ycm_complete_in_comments = 1
411
- let g: ycm_key_list_select_completion = [' <Tab>' , ' <C-n>' , ' <Down>' ]
412
- let g: ycm_key_list_previous_completion = [' <C-p>' , ' <Up>' ]
413
- let g: ycm_semantic_triggers = {
414
- \ ' c' : [' ->' , ' .' ],
415
- \ ' objc' : [' ->' , ' .' ],
416
- \ ' ocaml' : [' .' , ' #' ],
417
- \ ' cpp,objcpp' : [' ->' , ' .' , ' ::' ],
418
- \ ' perl' : [' ->' ],
419
- \ ' php' : [' ->' , ' ::' , ' (' , ' use ' , ' namespace ' , ' \' ],
420
- \ ' cs,java,typescript,javascript,d,python,perl6,scala,vb,elixir,go' : [' .' ],
421
- \ ' html' : [' <' , ' "' , ' </' , ' ' ],
422
- \ ' vim' : [' re![_a-za-z]+[_\w]*\.' ],
423
- \ ' ruby' : [' .' , ' ::' ],
424
- \ ' lua' : [' .' , ' :' ],
425
- \ ' erlang' : [' :' ],
426
- \ ' haskell' : [' .' , ' re!.' ],
427
- \ ' css' : [ ' re!^\s{2,4}' , ' re!:\s+' ],
428
- \ }
429
-
430
- " powerful snippets plugin, ctrl+\ to trigger
431
- Plug ' SirVer/ultisnips' | Plug ' honza/vim-snippets'
432
- let g: UltiSnipsExpandTrigger= " <c-\\ >"
433
- let g: UltiSnipsJumpForwardTrigger= " <c-b>"
434
- let g: UltiSnipsJumpBackwardTrigger= " <c-z>"
435
-
436
- " add comment quickly
437
- Plug ' scrooloose/nerdcommenter'
438
-
439
- " add surround character quickly
440
- " Mappings:
441
- " surround with: ysiw
442
- " unsurround with: ds
443
- Plug ' tpope/vim-surround'
444
-
445
- " for repeat -> enhance surround.vim, . to repeat command
446
- Plug ' tpope/vim-repeat'
447
-
448
- Plug ' Raimondi/delimitMate'
449
- let delimitMate_matchpairs = " (:),[:],{:}"
450
-
451
- " for code alignment
452
- Plug ' godlygeek/tabular'
453
- nmap <Leader> a= :Tabularize /=<CR>
454
- vmap <Leader> a= :Tabularize /=<CR>
455
- nmap <Leader> a: :Tabularize /:<CR>
456
- vmap <Leader> a: :Tabularize /:<CR>
457
- nmap <Leader> a" :Tabularize /"<CR>
458
- vmap <Leader> a" :Tabularize /"<CR>
459
-
460
- " for mutil cursor
461
- Plug ' terryma/vim-multiple-cursors'
462
-
463
- Plug ' mattn/emmet-vim'
464
-
465
- Plug ' Ioannis-Kapoulas/vim-autoprefixer'
466
-
467
- " ################# syntax check ###############
468
-
469
- Plug ' scrooloose/syntastic'
470
- let g: syntastic_error_symbol= ' ✗'
471
- let g: syntastic_warning_symbol= ' ⚠'
472
- let g: syntastic_style_error_symbol= ' ~'
473
- let g: syntastic_style_warning_symbol= ' ⚠'
474
- let g: syntastic_check_on_open= 1
475
- let g: syntastic_enable_highlighting = 0
476
- let g: syntastic_javascript_checkers = [' eslint' ]
477
- " ################# Highlight ###############
478
-
479
- " highlight for css3
480
- Plug ' hail2u/vim-css3-syntax'
481
-
482
- " for markdown
483
- Plug ' plasticboy/vim-markdown'
484
- let g: vim_markdown_folding_disabled= 1
485
- let g: vim_markdown_no_default_key_mappings= 1
486
- let g: vim_markdown_frontmatter= 1
487
-
488
- " for javascript
489
- Plug ' pangloss/vim-javascript' , {' branch' : ' develop' }
490
-
491
- Plug ' ruanyl/vim-fixmyjs' , {' on' : ' Fixmyjs' }
492
-
493
- Plug ' kchmck/vim-coffee-script' , {' for' : ' coffee' }
494
-
495
- " Syntax for JavaScript libraries
496
- Plug ' othree/javascript-libraries-syntax.vim'
497
-
498
- " AngularJS with Vim
499
- Plug ' burnettk/vim-angular'
500
-
501
- " ReactJS
502
- Plug ' mxw/vim-jsx'
503
- let g: jsx_ext_required = 0 " Allow JSX in normal JS files"
504
-
505
- " ################## Language Specific ##################
506
- " generate javascript doc
507
- Plug ' heavenshell/vim-jsdoc'
508
- let g: jsdoc_default_mapping = 0
509
- autocmd FileType javascript nnoremap <Leader> <Leader> d :JsDoc<CR>
510
-
511
- " Provides Tern-based JavaScript editing support. Require Nodejs installed
512
- Plug ' marijnh/tern_for_vim'
513
- let tern_show_signature_in_pum = 1
514
- autocmd FileType javascript nnoremap <leader> d :TernDef<CR>
515
- autocmd FileType javascript setlocal omnifunc = tern#Complete
516
-
517
- " Up to date PHP syntax
518
- Plug ' StanAngeloff/php.vim' , {' for' : ' php' }
519
-
520
- " improved PHP omnicompletion
521
- Plug ' shawncplus/phpcomplete.vim' , {' for' : ' php' }
522
-
523
- Plug ' ruanyl/vim-php-manual' , {' for' : ' php' }
524
- let g: php_manual_enable_online_search = 0
525
-
526
- " composer project php auto completion
527
- " Generate Index: :call padawan#GenerateIndex()
528
- " Start Server: :call padawan#StartServer()
529
- " Stop Server: :call padawan#StopServer()
530
- " Restart Server: :call padawan#RestartServer()
531
- " cd ~/.vim/bundle/padawan.vim/padawan.php && composer install
532
- Plug ' mkusher/padawan.vim' , {' for' : ' php' }
533
-
534
- Plug ' ruanyl/vim-caniuse' , {' on' : ' Caniuse' }
535
-
536
- " ################### Others ###################"
537
-
538
- " edit history, historical edit tree
539
- Plug ' sjl/gundo.vim' , {' on' : ' GundoToggle' }
540
- nnoremap <leader> h :GundoToggle<CR>
541
- let g: gundo_auto_preview = 0
542
-
543
- " format js, html, css files
544
- " require: npm install -g js-beautify
545
- Plug ' Chiel92/vim-autoformat' , {' on' : ' Autoformat' }
546
- autocmd FileType javascript,json,html,css,scss noremap <buffer> <leader><leader> f :Autoformat<cr>
547
-
548
- " quick run current buffer or selected code
549
- " Command: :QuickRun or :QuickRun {language}
550
- Plug ' thinca/vim-quickrun'
551
- " autocmd FileType go noremap <buffer> <leader>r :!go run %<cr>
552
-
553
- Plug ' mattn/webapi-vim'
554
-
555
- Plug ' tpope/vim-fugitive'
556
-
557
- " delete current buffer
558
- Plug ' moll/vim-bbye'
559
- nnoremap qq :Bdelete<cr>
560
-
561
- " delete all buffers except current one.
562
- " call :BufOnly
563
- Plug ' vim-scripts/BufOnly.vim'
564
- nnoremap <silent> qo :BufOnly<CR>
565
-
566
- Plug ' editorconfig/editorconfig-vim'
567
-
568
- call plug#end ()
569
-
570
- " ==========================================
571
- " Color&Theme
572
- " ==========================================
573
-
574
- filetype plugin indent on
575
-
576
- syntax enable
577
- syntax on
578
-
579
- " Set extra options when running in GUI mode
580
- if has (" gui_running" )
581
- set guifont = Monaco:h14
582
- set guioptions -= T
583
- set guioptions += e
584
- set guioptions -= r
585
- set guioptions -= L
586
- set guitablabel = % M\ % t
587
- set showtabline = 1
588
- set linespace = 2
589
- set noimd
590
- set t_Co = 256
237
+ " Load plugins
238
+ if filereadable (expand (" ~/.vim/vimrc.local" ))
239
+ source ~/.vim/vimrc.local
591
240
endif
592
-
593
- set background = dark
594
- set t_Co = 256
595
-
596
- colorscheme solarized
597
- " colorscheme molokai
598
- " colorscheme desert
599
-
600
- hi ! link SignColumn LineNr
601
- hi ! link ShowMarksHLl DiffAdd
602
- hi ! link ShowMarksHLu DiffChange
603
-
604
- " for error highlight
605
- highlight clear SpellBad
606
- highlight SpellBad term = standout ctermfg= 1 term = underline cterm= underline
607
- highlight clear SpellCap
608
- highlight SpellCap term = underline cterm= underline
609
- highlight clear SpellRare
610
- highlight SpellRare term = underline cterm= underline
611
- highlight clear SpellLocal
612
- highlight SpellLocal term = underline cterm= underline
613
-
614
- autocmd BufReadPre * if getfsize (expand (" %" )) > 10000000 | syntax off | endif
0 commit comments