C:\Vim\VIMPROJ\vimrc\_vimrc

来源:互联网 发布:oppor9怎么切换3g网络 编辑:程序博客网 时间:2024/05/22 01:44

” ========================================================================
“公孙小龙(chiyl) 的 vimrc
“我的联系方式:xidiandaily (AT) gmail (DOT) COM


” 许可:GPLv3
” ========================================================================
” 其他文件
runtime vimrc_example.vim
runtime macros/matchit.vim

if(has(“win32”) || has(“win95”) || has(“win64”) || has(“win16”))
let g:iswindows=1
else
let g:iswindows=0
endif

“定义默认的调用函数
function UPFILE_default()
echohl WarningMsg | echom “upload file tool has not build for this project type ;-0” | echohl None
return “error”
endfunction

function CSTAG_default()
echohl WarningMsg | echom ” I don’t know how to generate the CSTAG file for this project type ;-0” | echohl None
return “error”
endfunction

function ASTYLE_default()
echohl WarningMsg | echom ” I don’t know how to astyle this file for this project type ;-0” | echohl None
return “error”
endfunction

function SetProjType()
let choice=confirm(“Set Project Type”, “&cpp\n&pkm\n&php\n&&Cancel”,4)
if choice==1
“初始化CPP环境
source VIMPROJ/Tool/InitCPP.vimletg:projtype=cppcallInitCPP()elseifchoice==2PKMsourceVIMPROJ/Tool/InitPkm.vim
let g:proj_type=”pkm”
call InitPkm()
elseif choice==3
source $VIMPROJ/Tool/InitPHP.vim
let g:proj_type=”php”
call InitPHP()
endif
endfunction

“定义取用自定义函数(根据项目类型做出区别)名称接口
“定义项目配置时候需要使用的(全局)变量
let g:proj_type=”default”
let g:chiylown_func_dict={}
function g:chiylown_func_dict.getprojtypefunc(functype) dict
if(!has_key(self,a:functype))
echohl WarningMsg | echom “don’t know functype:”.a:functype | echohl None
return “”
endif
if(!has_key(self[a:functype],g:proj_type))
return get(self[a:functype],”default”,”error”)
else
return get(self[a:functype],g:proj_type,”error”)
endif
endfunction

let g:chiylown_func_dict[“UPFILE”]={“default”:”UPFILE_default”}
let g:chiylown_func_dict[“CSTAG”]={“default”:”CSTAG_default”}
let g:chiylown_func_dict[“ASTYLE”]={“default”:”ASTYLE_default”}

“禁用vi兼容模式(原始的vi功能太少了,没必要考虑兼容)
set nocompatible
“”开启文件检测,使得 snipMate 能够正确加载
:filetype on

“set相关
set nobackup
set rnu “自动显示行号
set nowrap “不自动换行
set sw=4 “将shiftwidth设为4
set ts=4 “将tabstop设为4
“字体的设置
set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI “记住空格用下划线代替哦
“set gfw=幼圆:h10:cGB2312
set shiftwidth=4
set softtabstop=4
set tabstop=4 “让一个tab等于4个空格
set autoindent “always set autoindenting on
set smartindent “set smart indent
set smarttab “use tabs at the start of a line, spaces elsewhere
set expandtab
“set tw=80 “宽度为80时自动换行
“set fo+=Mm “中文宽度80时也自动换行
colorscheme lucius
au BufNewFile,BufRead *.t2t set ft=txt2tags
” SystemTap scripts
au BufNewFile,BufRead *.stp set ft=stap
set fileencodings=utf-8,cp936,gb2312,gbk,gb18030
set encoding=utf-8
set fenc=utf-8
language message zh_CN.utf-8
“解决菜单乱码
source VIMRUNTIME/delmenu.vimsourceVIMRUNTIME/menu.vim

“Tlist设置
let Tlist_Ctags_Cmd=’ctags’ “因为我们放在环境变量里,所以可以直接执行
let Tlist_Use_Right_Window=0 “让窗口显示在右边,0的话就是显示在左边
let Tlist_Show_One_File=0 “让taglist可以同时展示多个文件的函数列表,如果想只有1个,设置为1
let Tlist_File_Fold_Auto_Close=1 “非当前文件,函数列表折叠隐藏
let Tlist_Exit_OnlyWindow=1 “当taglist是最后一个分割窗口时,自动推出vim
let Tlist_Process_File_Always=0 “不是一直实时更新tags,因为没有必要
let Tlist_Inc_Winwidth=0
“配置NERDTree
let NERDChristmasTree=1 ” more colorful
let NERDTreeWinPos=”right” ” put NERDTree at right
let NERDTreeWinSize=25 ” set size
let NERDTreeShowLineNumbers=0 ” show line number

“map相关
“更新TAG
map :set encoding=utf-8 | language message zh_CN.utf-8 | set fenc=utf-8
map :set encoding=cp936 | language message cp936 | set fenc=cp936
map :echo call(function(g:chiylown_func_dict.getprojtypefunc(“UPFILE”)),[])
map :echo call(function(g:chiylown_func_dict.getprojtypefunc(“ASTYLE”)),[])
map ::echo call(function(g:chiylown_func_dict.getprojtypefunc(“CSTAG”)),[])
map :call SetProjType()
“echo g:chiylown_func_dict.getprojtypefunc(“UPFILE”)
“更新函数列表
map Tl :silent! Tlist “按下F3就可以呼出了
map NT :NERDTree
“自动命令
“其他命令
“最后
set nu
call pathogen#infect()

0 0
原创粉丝点击