在~/.vimrc中添加一下内容,
或者在vimrc中添加:source ~/myvimrc
把下列内容添加到自己家目录下,myvimrc脚本中调用就可以了
autocmd BufNewFile *.[ch],*.hpp,*.cpp exec ":call SetComment()"
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 :xx@xx.com")
call append(line(".")+4, "* Date :".strftime("%Y-%m-%d")."")
call append(line(".")+5, "* Describe:None")
call append(line(".")+6, "*")
call append(line(".")+7, "********************************************************/")
endfunc