我到vimrc文件

if has("cscope")
set csto=0
set cst 
set nocsverb 
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
map <F5> :TlistToggle<CR>
let Tlist_Show_One_File=1  
let Tlist_Exit_OnlyWindow=1 
set ignorecase
set hlsearch
set ts=4
set expandtab

autocmd BufNewFile *.[ch],*.hpp,*.cpp exec ":call SetTitle()" 

 func SetComment()
     call setline(1,"/**************************************************************") 
     call append(line("."),   " * Copyright (C) ".strftime("%Y")." All rights reserved.")
     call append(line(".")+1, " * ") 
     call append(line(".")+2, " * FileName :".expand("%:t")) 
     call append(line(".")+3, " * Author:Hongtao Xu")
     call append(line(".")+4, " * Create Date :".strftime("%Y-%m-%d")) 
     call append(line(".")+5, " * Decript:") 
     call append(line(".")+6, " *")
     call append(line(".")+7, "**************************************************************/") 
 endfunc
 
func SetTitle()
    call SetComment()
    if expand("%:e") == 'hpp' 
        call append(line(".")+8, "#ifndef _".toupper(expand("%:t:r"))."_H_") 
        call append(line(".")+9, "#define _".toupper(expand("%:t:r"))."_H_") 
        call append(line(".")+10, "#ifdef __cplusplus") 
        call append(line(".")+11, "extern \"C\"") 
        call append(line(".")+12, "{") 
        call append(line(".")+13, "#endif") 
        call append(line(".")+14, "") 
:set nonumber                                                                                                                         1,1          頂端


發佈了58 篇原創文章 · 獲贊 8 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章