vimrc

来源:互联网 发布:午夜tv的软件 编辑:程序博客网 时间:2024/06/06 15:52

vimrc /etc/vim/vimrc


runtime! debian.vimif has("syntax")  syntax onendifif filereadable("/etc/vim/vimrc.local")  source /etc/vim/vimrc.localendifset guifont=DejaVu\ Sans\ mono\ book \ 11"设置默认目录cd /home/trylen/code"传说中的去掉边框用下边这一句set go="设置配色,这里选择的是desert,也有其他方案,在vim中输入:color 在敲tab键可以查看color desert"设置背景色,每种配色有两种方案,一个light、一个darkset background=light"打开语法高亮syntax on"显示行号set number"设置缩进有三个取值cindent(c风格)、smartindent(智能模式,其实不觉得有什么智能)、autoindent(简单的与上一行保持一致)set cindent"在windows版本中vim的退格键模式默认与vi兼容,与我们的使用习惯不太符合,下边这条可以改过来set backspace=indent,eol,start"用空格键替换制表符:set expandtab"制表符占4个空格set tabstop=4"默认缩进4个空格大小set shiftwidth=4"增量式搜索,比如键入"/bo",光标会自动找到第一个"bo"所在的位置set incsearch"符号匹配,一下出两个括号set showmatch"高亮搜索set hlsearch"有时中文会显示乱码,用一下几条命令解决let &termencoding=&encodingset fileencodings=utf-8,gbk"很多插件都会要求的配置检测文件类型filetype onfiletype plugin onfiletype indent on"下边这个很有用可以根据不同的文件类型执行不同的命令"例如:如果是c/c++类型:autocmd FileType c,cpp : set foldmethod=syntax:autocmd FileType c,cpp :set number:autocmd FileType c,cpp :set cindent"例如:如果是python类型:autocmd FileType python :set number:autocmd FileType python : set foldmethod=syntax:autocmd FileType python :set smartindent map <F9> :call CompileGcc()<CR>func! CompileGcc()    if&filetype == 'c'        exec "w"        exec "!gcc % -o %<"    elseif &filetype == 'cpp'        exec "w"        exec "!g++ % -o %<"    endifendfuncmap <F10> :call RunGcc()<CR>func! RunGcc()    exec "! ./%<"endfunclet g:neocomplcache_enable_at_startup = 1"-- omnicppcomplete setting --set tags+=~/.vim/tags/cppset completeopt=menu,menuonelet OmniCpp_MayCompleteDot = 1 " autocomplete with .let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->let OmniCpp_MayCompleteScope = 1 " autocomplete with ::let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included fileslet OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype  in popup windowlet OmniCpp_GlobalScopeSearch=1let OmniCpp_DisplayMode=1let OmniCpp_DefaultNamespaces=["std"]


0 0