现在的位置: 首页 > 综合 > 正文

我的VIM配置文件

2013年03月04日 ⁄ 综合 ⁄ 共 2354字 ⁄ 字号 评论关闭

set nocompatible

set tabstop=4

set expandtab

set nu

set ignorecase

set hlsearch

set cindent

set ruler

set shiftwidth=4

set number

set incsearch

set smartindent

set autowrite

let Tlist_Show_One_File=1

let TList_Exit_OnlyWindow=1

let g:winManagerWindowLayout='FileExplorer|TagList'

nmap wm :WMToggle<cr>

syntax on

colorscheme darkblue

map <F10> : call Do_CsTag()<CR>

map <F7>  : call Open_Prj()<CR>

function Do_CsTag()

    silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' > cscope.files"

    silent! execute "!cscope -bq -i cscope.files "

    silent! execute "cs add cscope.out"

endfunction

function Open_Prj()

    set autochdir

    call Set_CS()

    call Set_Tags()

    set noautochdir

endfunction

function Set_CS()

    if filereadable("cscope.out")

        silent!  execute "cs add cscope.out"

    endif

endfunction   

function Set_Tags()

    if filereadable("tags")

        execute "set tags=tags"

    endif

endfunction

call Set_CS()

call Set_Tags()

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

function Errorbells_off(...)

  " control Vim's audio and visual warnings

  " * Arguments:

  " "beep": turn off just beeping

  " "flash": turn off just flashing

  " (empty): both off

  " * Must be initialized after the GUI starts!

  " off

  if a:0 == 0

    let myeb = ""

  else

    let myeb = a:1

  endif

  if myeb ==? "flash"

    " audibly beep on error messages

    set errorbells

    " Screen flash on error (See also 't_vb')

    set novisualbell

    set t_vb=

  elseif myeb ==? "beep"

    " audibly beep on error messages

    set noerrorbells

    " Screen flash on error (See also 't_vb')

    set visualbell

    set t_vb&

  elseif myeb ==? ""

    " audibly beep on error messages

    set noerrorbells

    " Screen flash on error (See also 't_vb')

    set visualbell

    set t_vb=

  endif

endfunction

"turns off beeps

"call Errorbells_off("beep")

"turns off flashes

"call Errorbells_off("flash")

"turns off both

call Errorbells_off()

function Dos2Unix()

    silent execute ":%s//r/(/n/)//1/g"

endfunction

 

用到的插件:

 

效果:

 

抱歉!评论已关闭.