-
-
Save jokester/1787775 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" VIM配置文件 | |
" Author: Fanzeyi (fanzeyi1994[at]gmail.com) | |
" Last Modified Date: 2012-01-14 13:36 | |
" 设置语言及编码 | |
source $VIMRUNTIME/delmenu.vim | |
source $VIMRUNTIME/menu.vim | |
set enc=utf-8 | |
" set fencs=utf-8,ucs-bom,gbk,gb18030,shift-jis,gb2312,cp936 | |
" 常规设置 | |
set nocompatible " 关闭vi兼容模式 | |
set number " 打开行号 | |
filetype plugin on " 检测文件类型 | |
set history=1000 " 设置最多记忆命令行数1000行 | |
syntax on " 打开语法高亮 | |
set autoindent " 打开自动缩进 | |
set smartindent " 打开智能缩进 | |
set showmatch " 设置括号匹配 | |
set guioptions-=T " 去掉Toolbar | |
set vb t_vb= " 去掉声音提示 | |
set ruler " 右下角显示光标状态行 | |
set nohls " 关闭匹配的高亮显示 | |
set incsearch " 设置快速搜索 | |
set backspace=indent,eol,start " 设置<BS>键模式 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set tabstop=8 | |
set smarttab | |
set expandtab | |
set nobackup " 关闭自动保存 | |
set noswapfile " 关闭交换文件 | |
set laststatus=2 " 设置命令缓冲区可见 | |
set whichwrap+=<,>,h,l " 输入时光标会短暂位于相匹配的括号位置 | |
set fdm=syntax " 设置语法折叠 | |
set modeline " 設置Modeline | |
set go=i " 设置滚动条消失 | |
set cursorline " 十字高亮 | |
set cursorcolumn | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Bundle 'gmarik/vundle' | |
Bundle 'pylint.vim' | |
Bundle 'AutoComplPop' | |
Bundle 'molokai' | |
Bundle 'OmniCppComplete' | |
Bundle 'FencView.vim' | |
Bundle 'Lokaltog/vim-powerline' | |
Bundle 'nginx.vim' | |
Bundle 'SuperTab' | |
Bundle 'c.vim' | |
Bundle 'auto' | |
Bundle 'Tagbar' | |
" My Bundles here: | |
" | |
" original repos on github | |
filetype plugin indent on " required! | |
func! CompileRunGcc() " 自动编译运行程序 (gcc) | |
exec "w" | |
exec "make" | |
exec "!./%<" | |
endfunc | |
func! GdbCode() " 自动编译调试 (gdb) | |
exec "w" | |
exec "!gcc -Wall -lm -g % -o %<" | |
exec "!gdb ./%<" | |
endfunc | |
func! RunPython() | |
exec "w" | |
exec "!python %" | |
endfunc | |
func! AppendModeline() " 自動插入modeline | |
let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :", | |
\ &tabstop, &shiftwidth, &textwidth) | |
let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | |
call append(line("$"), l:modeline) | |
endfunc | |
" 键位绑定 | |
nmap <silent> <F4> :TagbarToggle<CR> | |
" F5为自动编译运行 | |
if &filetype == 'C' | |
map <F5> :call CompileRunGcc()<CR> | |
elseif &filetype == 'Python' | |
map <F5> :call RunPython()<CR> | |
endif | |
" F6为自动调试 | |
map <F6> :call GdbCode()<CR> | |
" 空格控制折叠 | |
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR> | |
" Ctrl+N 键下个错误 | |
map <C-N> : cn <CR> | |
" Ctrl+P 键上个错误 | |
map <C-P> : cp <CR> | |
" 自動插入 Modeline | |
nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | |
" 其他 | |
set makeprg=gcc\ -g\ -lm\ -Wall\ -o\ %<\ % " 设置make命令 | |
copen 5 " 自动打开QuickFix列表并设置高为5行 | |
colo molokai " 设置配色方案为lucius | |
set guifont=Zpix\ C.O.D.E\ Medium\ 14 " 设置字体 | |
" set guifont=Anonymous\ Pro\ 14 | |
set linespace=2 | |
set completeopt=longest,menu " 设置自动补全格式 | |
autocmd FileType * setlocal et sta sw=4 sts=4 | |
" 插件 | |
let g:tagbar_left = 1 | |
let g:tagbar_width = 20 | |
let g:tagbar_expand = 1 | |
let g:tagbar_iconchars = ['+', '-'] | |
" ACP插件 | |
let g:acp_enableAtStartup = 1 | |
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class | |
" PyLint | |
autocmd FileType python compiler pylint | |
" Powerline | |
let g:Powerline_symbols = 'fancy' | |
" Python自动补全 | |
let g:pydiction_location = '~/.vim/complete-dict' | |
" 其他编程语言补全 | |
if has("autocmd") && exists("+omnifunc") | |
autocmd Filetype * | |
\ if &omnifunc == "" | | |
\ setlocal omnifunc=syntaxcomplete#Complete | | |
\ endif | |
endif | |
let g:rubycomplete_buffer_loading = 1 | |
let g:rubycomplete_classes_in_global = 1 | |
let g:rubycomplete_rails = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment