Skip to content

Instantly share code, notes, and snippets.

@agassiyzh
Created November 26, 2013 03:38
Show Gist options
  • Save agassiyzh/7653124 to your computer and use it in GitHub Desktop.
Save agassiyzh/7653124 to your computer and use it in GitHub Desktop.
my vim config
set sh=/bin/bash
if has('vim_starting')
set nocompatible " Be iMproved
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'bling/vim-airline'
NeoBundle 'Align'
NeoBundle 'The-NERD-Commenter'
NeoBundle 'bufexplorer.zip'
NeoBundle 'The-NERD-tree'
NeoBundle 'surround.vim'
NeoBundle 'Tagbar'
NeoBundle 'ZenCoding.vim'
NeoBundle 'AndrewRadev/vim-coffee-script.git'
NeoBundle 'jQuery'
NeoBundle 'Indent-Guides'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'tpope/vim-haml'
NeoBundle 'hallison/vim-markdown'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'jmcantrell/vim-virtualenv'
NeoBundle 'slim-template/vim-slim'
NeoBundle 'vim-indent-object'
NeoBundle 'EasyMotion'
NeoBundle 'dbext.vim'
NeoBundle 'myhere/vim-nodejs-complete'
NeoBundle 'Stormherz/tablify'
NeoBundle 'SingleCompile'
NeoBundle 'clang-complete'
NeoBundle 'mattn/gist-vim'
NeoBundle 'mattn/webapi-vim'
NeoBundle 'kien/ctrlp.vim'
NeoBundle 'Shougo/neocomplete.vim'
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'sudo.vim'
filetype plugin indent on
NeoBundleCheck
syntax on
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 nu
set showcmd " display incomplete commands
set incsearch " do incremental searching
set autoread
set iskeyword+='-'
set autoindent
set smartindent
set cindent
set ambiwidth=double
augroup vimrcEx
au!
autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
set anti
set t_Co=256
"colorscheme desert
"colorscheme morning
colorscheme molokai
set cursorline
hi cursorline ctermbg=NONE cterm=underline
set formatoptions+=mM
set helplang=cn
function! MySys()
if has("win32") || has("win64")
return "windows"
elseif has("mac")
return "mac"
else
return "linux"
endif
endfunction
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set backupdir=~/.vim/backups
set dir=~/.vim/backups
set nobackup
"set nowritebackup
set undodir=~/.vim/undos
set undofile
set shiftwidth=4
set tabstop=4
set softtabstop=4
set smarttab
"set expandtab
set nowrap
set wildmenu
set matchpairs+=(:),{:},[:],<:>
set whichwrap=b,s,<,>,[,]
set foldmethod=syntax
set foldlevel=1
set diffopt+=iwhite,vertical " 忽略缩进的差异
"set cursorbind
"set gdefault
set so=7
"set rnu
set numberwidth=4
set equalalways
set guitablabel=%t
set laststatus=2
"set autochdir "自动进入编辑文件的目录
autocmd! bufwritepost .vimrc source ~/.vimrc
autocmd! bufwritepost vimrc source ~/.vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" filetype
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufNewFile,BufRead *.vm setlocal ft=html
autocmd BufNewFile,BufRead *.xul setlocal ft=xml
autocmd BufNewFile,BufRead *.as setlocal ft=actionscript
autocmd BufNewFile,BufRead *.json setlocal ft=javascript
autocmd BufNewFile,BufRead *.pac setlocal ft=javascript
autocmd BufNewFile,BufRead *.ypac setlocal ft=yaml
autocmd BufNewFile,BufRead *.wsgi setlocal ft=python
autocmd BufNewFile,BufRead Podfile setlocal ft=ruby
autocmd BufNewFile,BufRead *.podspec setlocal ft=ruby
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
"au BufNewFile,BufReadPost *.coffee setl foldmethod=indent
au FileType coffee setl foldmethod=indent foldlevel=0
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
" language support
"autocmd FileType javascript setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=79
"autocmd FileType ruby setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
autocmd FileType yaml setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
"autocmd FileType xml setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType html setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType php setlocal noexpandtab shiftwidth=4 tabstop=4 softtabstop=4
" turn on omnicompletion
set ofu=syntaxcomplete#Complete
" Omni Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"autocmd FileType c set omnifunc=ccomplete#Complete
"tags
autocmd FileType php set tags=php_tags
autocmd FileType javascript set tags=js_tags
autocmd FileType python set tags=py_tags
autocmd FileType php nnoremap <F12> :!ctags -R --exclude='/.git/' --languages=php --php-kinds=+cf-v --tag-relative=yes --totals=yes -f php_tags<cr>
autocmd FileType javascript nnoremap <F12> :!ctags -R --exclude='/.git/' --languages=javascript --javascript-kinds=-v --tag-relative=yes --totals=yes -f js_tags<cr>
autocmd FileType python nnoremap <F12> :!ctags -R --exclude='/.git/' --languages=python --python-kinds=-v --tag-relative=yes --totals=yes -f py_tags<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" map
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader=","
let g:mapleader=","
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
map <D-H> <C-h>
map <D-J> <C-j>
map <D-K> <C-k>
map <D-L> <C-l>
nnoremap <D-V> <C-w>v
noremap <leader>ee :e ~/.vimrc<cr>
noremap <leader>tb :TagbarToggle<cr>
noremap <silent><leader>nt :NERDTreeToggle<cr>
nmap <tab> v>
nmap <s-tab> v<
vmap <tab> >gv
vmap <s-tab> <gv
"移动长行
nnoremap <Down> gj
nnoremap <Up> gk
map <silent><A-Right> :bn<CR>
map <silent><A-Left> :bp<CR>
noremap <leader>a=> :Align =><cr>
nmap <leader>f :FufFile **/<CR>
nmap <F9> :SCCompile<cr>
nmap <F10> :SCCompileRun<cr>
let g:yankring_history_dir = '~/.vim'
"let g:indexer_disableCtagsWarning=1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
source $VIMRUNTIME/macros/matchit.vim
"highlighted
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
hi default ShowMarksHLl ctermfg=red ctermbg=black cterm=bold guifg=blue guibg=lightblue gui=bold
hi default ShowMarksHLu ctermfg=white ctermbg=blue cterm=bold guifg=blue guibg=lightblue gui=bold
hi default ShowMarksHLo ctermfg=white ctermbg=black cterm=bold guifg=blue guibg=lightblue gui=bold
hi default ShowMarksHLm ctermfg=red ctermbg=yellow cterm=bold guifg=blue guibg=lightblue gui=bold
let g:indent_guides_guide_size=1
"let g:EasyMotion_leader_key = '<Leader>'
let g:syntastic_enable_signs=1
let g:syntastic_check_on_open=1
let g:syntastic_auto_loc_list=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11'
let g:virtualenv_auto_activate=1
let g:xptemplate_vars='$author=Agassi_Yu&[email protected]'
let g:clang_complete_auto=0
let php_folding=1
let g:SingleCompile_alwayscompile = 0
call SingleCompile#ChooseCompiler('cpp', 'clang')
let g:airline_powerline_fonts = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment