Created
September 14, 2017 07:46
-
-
Save peterfei/0e84f8159bdebd48fb16043a2a67c075 to your computer and use it in GitHub Desktop.
.vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
" 1 tab to 2 space for ruby | |
set tabstop=2 | |
set softtabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
" number line show | |
set nu | |
set noswapfile | |
"in order to switch between buffers with unsaved change | |
set hidden | |
set paste | |
" hightlight column and line | |
set cursorline | |
"set cursorcolumn | |
filetype plugin indent on | |
syntax on | |
" support css word with - | |
autocmd FileType css,scss,slim,html,eruby,coffee,javascript setlocal iskeyword+=- | |
autocmd Filetype python setlocal tabstop=4 shiftwidth=4 softtabstop=4 | |
" vim 7.4 backspace fix | |
set backspace=indent,eol,start | |
set t_Co=256 | |
set mouse=a | |
" colorscheme, read here: http://vim.wikia.com/wiki/Change_the_color_scheme | |
colorscheme molokai | |
"colorscheme tomorrow-night | |
autocmd BufWritePre * :%s/\s\+$//e | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-sensible' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-dispatch' | |
if has("gui_running") | |
colorscheme desert | |
set bs=2 | |
set ruler | |
set gfn=Monaco:h16 | |
set shell=/bin/bash | |
endif | |
let mapleader= "," | |
" EasyMotion_leader_key . | |
" Plugin Plugin here for Ruby on Rails | |
" git | |
Plugin 'tpope/vim-fugitive' | |
" ruby command for rvm | |
Plugin 'tpope/vim-rvm' | |
" quickly move cursor, try ,,w | |
Plugin 'Lokaltog/vim-easymotion' | |
" quickly write HTML, just like zencoding but simple engough | |
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} | |
"let g:sparkupNextMapping= "<c-m>" | |
Plugin 'mattn/emmet-vim' | |
"let g:user_emmet_install_global = 0 | |
let g:user_emmet_mode='a' | |
"autocmd FileType html,css,eruby EmmetInstall | |
let g:user_emmet_leader_key='<Tab>' | |
let g:user_emmet_expandabbr_key='<Tab>' | |
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>") | |
" power vim plugin for rails | |
Plugin 'tpope/vim-rails' | |
" vim rails syntax complete, try ctrl+x ctrl+u | |
set completefunc=syntaxcomplete#Complete | |
" quickly comment your code, try ,cc on selected line | |
Plugin 'vim-scripts/The-NERD-Commenter' | |
" indent guides | |
let g:indent_guides_guide_size = 1 | |
Plugin 'nathanaelkane/vim-indent-guides' | |
" indent guides shortcut | |
map <silent><F7> <leader>ig | |
" markdown support | |
let g:indent_guides_guide_size = 1 | |
Plugin 'godlygeek/tabular' | |
Plugin 'plasticboy/vim-markdown' | |
" file tree like something called IDE | |
Plugin 'scrooloose/nerdtree' | |
map <silent><F8> :NERDTree<CR> | |
map <leader>r :NERDTreeFind<cr> | |
map <leader>e :NERDTreeToggle<cr> | |
map <leader>y "+y<cr> | |
map <leader>p "+p<cr> | |
" coffeescript | |
Plugin 'kchmck/vim-coffee-script' | |
autocmd BufNewFile,BufRead *.coffee set filetype=coffee | |
" basic dependence | |
Plugin 'L9' | |
" slim template support | |
Plugin 'slim-template/vim-slim.git' | |
" hack filetype for slim | |
autocmd BufNewFile,BufRead *.slim set filetype=slim | |
autocmd BufNewFile,BufRead *.es6 set filetype=javascript | |
" quickly search file(s), use ctrl+p, F5 refresh | |
Plugin 'kien/ctrlp.vim' | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_cmd = 'CtrlP' | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip | |
"let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' | |
let g:ctrlp_custom_ignore = '\v[\/]\.(DS_Store|git|hg|svn)|(optimized|compiled|node_modules|bower_compenents)$' | |
map <c-o> :CtrlPBuffer<CR> | |
let g:syntastic_javsacript_checkers = ['eslint'] | |
Plugin 'leafgarland/typescript-vim' | |
" sass highlight | |
Plugin 'JulesWang/css.vim' | |
Plugin 'cakebaker/scss-syntax.vim' | |
Plugin 'isRuslan/vim-es6' | |
Plugin 'Quramy/vim-js-pretty-template' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'rdnetto/YCM-Generator' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'jistr/vim-nerdtree-tabs' | |
Plugin 'posva/vim-vue' | |
call vundle#end() | |
autocmd BufRead,BufNewFile *.ts set filetype=typescript | |
let g:typescript_compiler_binary = 'tsc' | |
let g:typescript_compiler_options = '' | |
autocmd QuickFixCmdPost [^l]* nested cwindow | |
autocmd QuickFixCmdPost l* nested lwindow | |
" 使用内置 tab 样式而不是 gui | |
set guioptions-=e | |
set nolist | |
" set listchars=tab:?\ ,eol:?,trail:·,extends:>,precedes:< | |
set guifont=Inconsolata:h16 | |
" }}} | |
" Format {{{ | |
"set autoindent | |
"set smartindent | |
"set tabstop=4 | |
"set expandtab | |
"set softtabstop=4 | |
"set foldmethod=indent | |
"syntax on | |
"set helplang=cn | |
nnoremap <leader>gl :YcmCompleterGoToDeclaration<CR> | |
nnoremap <leader>gf :YcmCompleterGoToDefinition<CR> | |
nnoremap <leader>gg :YcmCompleterGoToDefinitionElseDeclaration<CR> | |
let g:ycm_error_symbol = '>>' | |
let g:ycm_warning_symbol = '>*' | |
nmap <F4> :YcmDiags<CR> | |
" 不显示开启vim时检查ycm_extra_conf文件的信息 | |
let g:ycm_confirm_extra_conf = 0 | |
" 开启基于tag的补全,可以在这之后添加需要的标签路径 | |
let g:ycm_collect_identifiers_from_tags_files = 1 | |
" 开启语义补全 | |
let g:ycm_seed_identifiers_with_syntax = 1 | |
"注释和字符串中的文字也会被收入补全 | |
let g:ycm_collect_identifiers_from_comments_and_strings = 0 | |
" 输入第 2 个字符开始补全 | |
let g:ycm_min_num_of_chars_for_completion= 2 | |
" 禁止缓存匹配项,每次都重新生成匹配项 | |
let g:ycm_cache_omnifunc=0 | |
"在注释输入中也能补全 | |
let g:ycm_complete_in_comments = 1 | |
"在字符串输入中也能补全 | |
let g:ycm_complete_in_strings = 1 | |
"定义快捷健补全 | |
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] | |
let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>'] | |
" 设置在下面几种格式的文件上屏蔽ycm | |
let g:ycm_filetype_blacklist = { | |
\ 'tagbar' : 1, | |
\ 'qf' : 1, | |
\ 'notes' : 1, | |
\ 'markdown' : 1, | |
\ 'unite' : 1, | |
\ 'text' : 1, | |
\ 'vimwiki' : 1, | |
\ 'pandoc' : 1, | |
\ 'infolog' : 1, | |
\ 'mail' : 1 | |
\} | |
"设置关健字触发补全 | |
let g:ycm_semantic_triggers = { | |
\ 'c' : ['->', '.', ' ', '(', '[', '&'], | |
\ 'objc' : ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s', | |
\ 're!\[.*\]\s'], | |
\ 'ocaml' : ['.', '#'], | |
\ 'cpp,objcpp' : ['->', '.', '::'], | |
\ 'perl' : ['->'], | |
\ 'php' : ['->', '::'], | |
\ 'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['.'], | |
\ 'ruby' : ['.', '::'], | |
\ 'lua' : ['.', ':'], | |
\ 'erlang' : [':'], | |
\ } | |
let g:ycm_cache_omnifunc = 1 | |
let g:ycm_use_ultisnips_completer = 1 | |
map <Leader>n <plug>NERDTreeTabsToggle<CR> | |
"let g:nerdtree_tabs_open_on_console_startup=1 | |
imap <expr><tab> | |
\ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : | |
\ emmet#isExpandable() ? "\<C-e>" : | |
\ pumvisible() ? "\<C-n>" : | |
\ "\<tab>" | |
autocmd FileType vue syntax sync fromstart | |
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css | |
"" By Robin | |
let g:EasyMotion_smartcase = 1 | |
"let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion | |
map <Leader><Leader>j <Plug>(easymotion-j) | |
map <Leader><Leader>k <Plug>(easymotion-k) | |
map <Leader><leader>h <Plug>(easymotion-linebackward) | |
map <Leader><leader>l <Plug>(easymotion-lineforward) | |
map <Leader><leader>. <Plug>(easymotion-repeat) | |
nmap s <Plug>(easymotion-s) | |
" NERDTree: File highlighting | |
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) | |
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg | |
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' | |
endfunction | |
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') | |
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') | |
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') | |
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') | |
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') | |
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') | |
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') | |
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment