set nocompatible
if !exists("syntax_on")
syntax on
endif
"windows model
"source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
"配色方案
colo darkblue
"不备份文件,备份文件很讨厌
set nobackup
"显示行号
"set nu
"设置tab字符个数
set tabstop=4
"设置自动将Tab键替换为空格
set expandtab
"设置回车换行后自动缩进宽度为4字符
set shiftwidth=4
"自动缩进
set autoindent
"更方便的退格键
set backspace=2
"查找高亮
set hlsearch
"增量查找
set incsearch
map V :w
"去除行首空格
map K :s/^[ ]*//
syntax on " Enable syntax highlighting
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!
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END
"自动检测文件类圿filetype on
"映射F8为显示列蟿需要taglist插件
nnoremap <silent> <F8> :Tlist<CR>
"字体
if (has("gui_running"))
set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
endif
"----------------below for txt file
"让文本文件也有高亮,thanks to xbeta@smth
augroup filetypedetect
au BufNewFile,BufRead *.* setf ztxt
augroup END
"缓冲区写入文件的时候自动检查文件类圿au BufWritePost * filet detect
"设定文件编码类型,彻底解决中文编码问頿let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936
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
set suffixesadd=.rb
set includeexpr+=substitute(v:fname,'s$','','g')
" or you can add substitution pattern s/ies$/y/g, s/ves$/f/g like this:
" set includeexpr+=substitute(substitute(substitute(v:fname,'s$','','g'),'ie$','y','g'),'ve$','f','g')
"let loaded_project=1
map <F11> <Esc>:set suffixesadd=.rb<CR>gf
map <F12> <Esc>:set suffixesadd=.rhtml<CR>gf
下面的命令可以设置或是取消缩进;
autoindent(自动缩进,即每行的缩进值与上一行相等;使用 noautoindent 取消设置)
说明:拷贝粘贴 就在已经缩进的基础上再缩进,所以就变得很乱.
可以 set noautoindent或者设置 set paste来解决
if !exists("syntax_on")
syntax on
endif
"windows model
"source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
"配色方案
colo darkblue
"不备份文件,备份文件很讨厌
set nobackup
"显示行号
"set nu
"设置tab字符个数
set tabstop=4
"设置自动将Tab键替换为空格
set expandtab
"设置回车换行后自动缩进宽度为4字符
set shiftwidth=4
"自动缩进
set autoindent
"更方便的退格键
set backspace=2
"查找高亮
set hlsearch
"增量查找
set incsearch
map V :w
"去除行首空格
map K :s/^[ ]*//
syntax on " Enable syntax highlighting
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!
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END
"自动检测文件类圿filetype on
"映射F8为显示列蟿需要taglist插件
nnoremap <silent> <F8> :Tlist<CR>
"字体
if (has("gui_running"))
set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
endif
"----------------below for txt file
"让文本文件也有高亮,thanks to xbeta@smth
augroup filetypedetect
au BufNewFile,BufRead *.* setf ztxt
augroup END
"缓冲区写入文件的时候自动检查文件类圿au BufWritePost * filet detect
"设定文件编码类型,彻底解决中文编码问頿let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936
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
set suffixesadd=.rb
set includeexpr+=substitute(v:fname,'s$','','g')
" or you can add substitution pattern s/ies$/y/g, s/ves$/f/g like this:
" set includeexpr+=substitute(substitute(substitute(v:fname,'s$','','g'),'ie$','y','g'),'ve$','f','g')
"let loaded_project=1
map <F11> <Esc>:set suffixesadd=.rb<CR>gf
map <F12> <Esc>:set suffixesadd=.rhtml<CR>gf
下面的命令可以设置或是取消缩进;
autoindent(自动缩进,即每行的缩进值与上一行相等;使用 noautoindent 取消设置)
说明:拷贝粘贴 就在已经缩进的基础上再缩进,所以就变得很乱.
可以 set noautoindent或者设置 set paste来解决