本人常用的gvim配置(windows下)
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
filetype plugin indent on "开启插件
set nocp "vim工作在不兼容状态下,更好的发挥自身特点
set autochdir "首先在当前目录中寻早tags
set guifont=Courier_New:h12:cANSI "设置字体和字体大小
set nocompatible "不实用vi的键盘模式,使用vim自己的
set noeb "处理未保存或只读问件事,弹出确认
set number "显示行号
set tabstop=4 "Tab键的宽度为4
set shiftwidth=4 "不要用空格代替制表符
set nobackup "不进行备份
set autoindent "自动缩进
set smartindent "为C程序提供自动缩进
set showmatch "匹配括号高亮
set ruler "显示光标和状态行
set shortmess=atI "启动时不显示乌干达儿童的提示
set magic "显示括号配对情况
set foldenable "开始折叠
set foldmethod=syntax "设置语法折叠
setlocal foldlevel=1 "设置折叠层数为1
"设置工具栏
if has("gui_running")
set guioptions-=m "隐藏菜单栏
set guioptions-=T "隐藏工具栏
set guioptions-=L "隐藏左侧滚动条
set guioptions+=r "显示右侧滚动条
set showtabline=0 "隐藏Tab栏
endif
syn on "打开代码高亮功能
filetype on "侦测文件类型
"编码字体设置
set termencoding=chinese
set fileencodings=ucs-bom,utf-8,default,chinese,big5
"默认最大化
"if has("win32")
" au GUIEnter * simalt ~x "窗口最大化
"endif
"配色方案选择cleanphp和aqua比较好看
"asu1dark是黑色的,颜色还可以;breeze是墨绿色的背景,也还可以;buttersream,黄色的背景",有利于保护视力,clarity也不错,蓝色的背景;darkslategrey,深绿色的背景,不错;darks"pectrum,褐色偏黑,还可以;dw_red黑色背景,红色的提示字,还不错;fog也可以试试;matri"x,黑客帝国的颜色,可以一试;night这个背景是紫色,光线很柔和人
colo night
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction