您的位置:首页 > 其它

vim配置文件

2011-09-14 23:18 281 查看
set nocompatible

source $VIMRUNTIME/vimrc_example.vim

source $VIMRUNTIME/mswin.vim

behave mswin

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

"========================================================

" Highlight All Math Operator

"========================================================

" C math operators

syn match cMathOperator display "[-+\*/%=]"

" C pointer operators

syn match cPointerOperator display "->\|\."

" C logical operators - boolean results

syn match cLogicalOperator display "[!<>]=\="

syn match cLogicalOperator display "=="

" C bit operators

syn match cBinaryOperator display "\(&\||\|\^\|<<\|>>\)=\="

syn match cBinaryOperator display "\~"

syn match cBinaryOperatorError display "\~="

" More C logical operators - highlight in preference to binary

syn match cLogicalOperator display "&&\|||"

syn match cLogicalOperatorError display "\(&&\|||\)="

"========================================================

" Math Operator

"========================================================

hi cMathOperator guifg=#3EFFE2

hi cPointerOperator guifg=#3EFFE2

hi cLogicalOperator guifg=#3EFFE2

hi cBinaryOperator guifg=#3EFFE2

hi cBinaryOperatorError guifg=#3EFFE2

hi cLogicalOperator guifg=#3EFFE2

hi cLogicalOperatorError guifg=#3EFFE2

"========================================================

" My Own DataType

"========================================================

syn keyword cType My_Type_1 My_Type_2 My_Type_3

"========================================================

"VIM 辅助

"========================================================

"set tags="D:\Working\Setup\vim辅助工具\vim辅助工具\ctags58\ctags58\tags"

set nu "显示行号

color murphy "设置配色方案为torte

set fileencodings=utf-8,chinese "设置支持的文件编码类项,目前设置为utf-8和gbk两种类型

" TAB距离 (vim配置; vim技巧)

set tabstop=4 " 保存一个tab是4个字符

set softtabstop=4 " 按一次tab前进4个字符

set shiftwidth=4 " shiftwidth写代码时用到,缩进为4字符

set cindent

set nobackup " 让VIM不生成备份文件(~文件)

" 打开文件时光标自动到上次退出该文件时的光标所在位置

autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal`\"" | endif

if has("win32")

set guifont=Nimbus_Mono_l:h15:cANSI

"set guifontwide=楷体_GB2312:h10

"set guifontwide=YaHei Consolas Hybrid:h10

au GUIEnter * simalt ~x " 窗口最大化

endif

colorscheme koehler " 颜色类型

set pastetoggle=<F11> " pastetoggle(粘贴模式切换)可以避免自动缩进

" 的带来的格式影响;每次按下<F11>键可以打开

" /关闭自动缩进功

set expandtab " 将tab键转换为空格

"-----------------------------------------------

"代码折叠

"-----------------------------------------------

set foldmethod=syntax " 用语法高亮来定义折叠

set foldmethod=indent " 更多的缩进表示更高级别的折叠(这个似乎效果好一些)

"========================================================

"CTAGS 辅助

"========================================================

set tags=/usr/tags;

set autochdir

"========================================================

"OmniCppComplete 辅助

"========================================================

let OmniCpp_NamespaceSearch = 1

let OmniCpp_GlobalScopeSearch = 1

let OmniCpp_ShowAccess = 1

let OmniCpp_ShowPrototypeInAbbr = 1 " 显示函数参数列表

let OmniCpp_MayCompleteDot = 1 " 输入 . 后自动补全

let OmniCpp_MayCompleteArrow = 1 " 输入 -> 后自动补全

let OmniCpp_MayCompleteScope = 1 " 输入 :: 后自动补全

let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]

" 自动关闭补全窗口

au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif

set completeopt=menuone,menu,longest

let g:SuperTabRetainCompletionType=2

"========================================================

"MiniBufExplorer设置

"========================================================

let g:miniBufExplMapCTabSwitchBufs = 1

"========================================================

"a.vim设置

"========================================================

nnoremap <silent> <F12> :A<CR>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: