set nocompatible "设定 gvim 运行在增强模式下,不使用vi的键盘模式 set helplang=cn "设置帮助的语言 filetype on "设置文件类型的检测 filetype plugin on "为特定的文件类型允许插件文件的载入 set et "编辑时将所有 Tab 替换为空格 set sw=2 "自动缩进的时候, 缩进尺寸为 2 个空格 set sts=2 "设置 softtabstop 为 2. 输入 tab 后就跳了2格. set smarttab "行首的 根据 'shiftwidth' 插入空白 let php_folding = 1 "折叠类、函数等 set backspace=indent,eol,start "不设定的话在插入状态无法用退格键和 Delete set nobackup " 覆盖文件时不备份 set history=50 " 设置在命令行显示多少历史记录 set showcmd " 在状态栏显示目前所执行的指令 set incsearch " 输入搜索内容时就显示搜索结果 set number " 显示行号 "打开自动缩进和 C 语言风格的缩进模式,定制 C 语言缩进风格 set cindent set autoindent set mouse=a " 设定在任何模式下鼠标都可用 set scrolloff=5 " 设定光标离窗口上下边界 5 行时窗口自动滚动 set ignorecase " 搜索时忽略大小写 set smartcase "但在有一个或以上大写字母时,仍保持对大小写敏感 set hid " 允许在有未保存的修改时切换缓冲区,此时的修改由切换由 vim 负责保存 set shiftwidth=2 " 设定 << 和 >> 命令移动时的宽度为 4 set showmatch " 在输入括号时光标会短暂地跳到与之相匹配的括号处,不影响输入 "设置 折行 set textwidth=84 set wrap syn on set completeopt=menu,longest,preview set confirm "解决乱码 set encoding=utf-8 set fileencodings=utf-8,chinese,latin-1 if has("win32") set fileencoding=chinese else set fileencoding=utf-8 endif "解决菜单乱码 source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim "解决consle输出乱码 language messages zh_CN.utf-8 "设置CTAGS "let Tlist_Ctags_Cmd = 'E:\vim72\ctag\ctags.exe' let Tlist_Auto_Open = let Tlist_Exit_OnlyWindow = 1 let Tlist_Use_Right_Window =1 let tlist_actionscript_settings = 'actionscript;c:class;f:method;p:property;v:variable' set tags=./tags,./../tags,./**/tags "设置配色方案 "colorscheme vibrantink "设置字体 set guifont=Lucida_Console:h11:b "设置 bufexplorer map :FirstExplorerWindow map :BottomExplorerWindow map :NERDTreeToggle "去掉烦死我的错误声音 set vb t_vb= "工作目录随文件变 autocmd BufEnter * cd %:p:h "设置状态栏 set statusline+=%f "不显示工具条 set guioptions-=T "显示横向滚动条 set guioptions+=b "设置自动补全 setl omnifunc=nullcomplete#Complete autocmd FileType * setl omnifunc=nullcomplete#Complete autocmd FileType python setl omnifunc=pythoncomplete#Complete autocmd FileType javascript setl omnifunc=javascriptcomplete#CompleteJS autocmd FileType html setl omnifunc=htmlcomplete#CompleteTags noci autocmd FileType css setl omnifunc=csscomplete#CompleteCSS noci autocmd FileType xml setl omnifunc=xmlcomplete#CompleteTags autocmd FileType php setl omnifunc=phpcomplete#CompletePHP autocmd FileType c setl omnifunc=ccomplete#Complete "设定状态条 set cmdheight=1 " 设定命令行的行数为 1 set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏) set statusline=%F%m%r,%Y,%{&fileformat}\ \ \ ASCII=\%b,HEX=\%B\ \ \ %l,%c%V\ %p%%\ \ \ [\ %L\ lines\ in\ all\ ] "设置智能大小写查找 set ignorecase smartcase "设置标尺 set ruler "打开状态栏标尺 "设置制表符 set cindent shiftwidth=2 set softtabstop=2 set smarttab set list "显示制表符 set listchars=tab:>- "设置标签 function GuiTabLabel() let label = '' let bufnrlist = tabpagebuflist(v:lnum) " 如果标签页里有修改过的缓冲区,加上 '+' for bufnr in bufnrlist if getbufvar(bufnr, "&modified") let label = '+' break endif endfor " 如果标签页里的窗口数目多于一,加上窗口数目 let wincount = tabpagewinnr(v:lnum, '$') if wincount > 1 let label .= wincount endif if label != '' let label .= ' ' endif " 附加缓冲区名 label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) endfunction set guitablabel=%{GuiTabLabel()} set guitablabel=%N\ %f "设置php注释 "source $vimruntime\vimfiles\plugin\php-doc.vim inoremap :call PhpDocSingle()i nnoremap :call PhpDocSingle() vnoremap :call PhpDocRange() "设置putty let g:netrw_sftp_cmd = "PSFTP" "设置quickfix "php语法检查 setlocal makeprg=\"d:\wamp\bin\php\php5.2.6\php.exe\"\ -l\ -n\ -d\ html_errors=off\ % setlocal errorformat=%m\ in\ %f\ on\ line\ %l "autocmd BufWritePost *.php,*.phps :make map :w:noh:make