"source $VIMRUNTIME/vimrc_example.vim
set nocompatible
if !exists("syntax_on")
syntax on
endif
"set runtimepath+=/data/setup/vim/snippetsEmu
"set runtimepath+=/data/setup/vim/snippetsEmu/after
"let b:html_tag_case="lowercase"
"设置tab字符个数
set tabstop=2
set shiftwidth=2
set nu
" 设置行号留空大小
set nuw=1
set fdc=0
"自动缩进
set autoindent
"更方便的退格键
set backspace=2
"设置fold栏位宽度为0,我不使用fold,感觉总有问题,不爽
set fdc=2
"自动检测文件类型
filetype on
filetype plugin on
"映射F8为显示列表,需要taglist插件
nnoremap <silent> <F8> :Tlist<CR>
" 让Taglist的窗口在右边
let Tlist_Use_Right_Window=1
" 不让其改变窗口大小
let Tlist_Inc_Winwidth=0
"映射F5为make指令
nnoremap <silent> <F5> :w<CR>:make<CR>
"配色文件
if (has("gui_running"))
"colorscheme inkpot
else
colorscheme ron
endif
"if ((has("gui_running")))
" color ps_color
" Colo warm
"else
" color ron
" "color ps_color
" "Colo cool
"endif
"对python文件进行特殊设置
if has("autocmd")
filetyp plugin indent on
autocmd FileType python setlocal et | setlocal sta | setlocal sw=4
autocmd FileType python compiler pyunit
autocmd FileType python setlocal makeprg=python\ %
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd BufNewFile *.py 0r ~/project/template.py
endif
"au FileType python source .vim/plugin/python.vim
"字体
if (has("gui_running"))
" set guifont=Bitstream\ Vera\ Sans\ Mono\ 11
set guifont=Consolas\ 11
endif
" 禁用netrw,这个似乎是读写网络文件的
":let loaded_netrw = 1
"----------------below for txt file
"让文本文件也有高亮,thanks to xbeta@smth
augroup filetypedetect
"au BufNewFile,BufRead *.* setf txt
"缓冲区写入文件的时候自动检查文件类型
au BufWritePost * filet detect
"配置reStructured Text文件类型
au BufNewFile,BufRead *.vst set ft=rest
augroup END
"设定文件编码类型,彻底解决中文编码问题
let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936,big5,utf-16,euc-jp
" 中文帮助
if version > 603
set helplang=cn
endi
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
" ruby
filetype plugin indent on " Enable filetype-specific indenting and plugins
" Load matchit (% to bounce from do to end, etc.)
runtime! macros/matchit.vim
augroup myfiletypes
"autocmd! " Clear old autocmds in group
" autoindent with two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
"" Encoding settings
"if has("multi_byte")
" " Set fileencoding priority
" if getfsize(expand("%")) > 0
" set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
" else
" set fileencodings=cp936,big5,euc-jp,euc-kr,latin1
" endif
"
" " CJK environment detection and corresponding setting
" if v:lang =~ "^zh_CN"
" " Use cp936 to support GBK, euc-cn == gb2312
" set encoding=cp936
" set termencoding=cp936
" set fileencoding=cp936
" elseif v:lang =~ "^zh_TW"
" " cp950, big5 or euc-tw
" " Are they equal to each other?
" set encoding=big5
" set termencoding=big5
" set fileencoding=big5
" elseif v:lang =~ "^ko"
" " Copied from someone's dotfile, untested
" set encoding=euc-kr
" set termencoding=euc-kr
" set fileencoding=euc-kr
" elseif v:lang =~ "^ja_JP"
" " Copied from someone's dotfile, unteste
" set encoding=euc-jp
" set termencoding=euc-jp
" set fileencoding=euc-jp
" endif
" " Detect UTF-8 locale, and replace CJK setting if needed
" if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
" set encoding=utf-8
" set termencoding=utf-8
" set fileencoding=utf-8
" endif
"else
" echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
"endif
"
"
-