一、李导版本
autocmd BufNewFile *.py,*.cc,*.sh,*.java exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1, "#!/bin/bash")
call setline(2, "##############################################################")
call setline(3, "# File Name: ".expand("%"))
call setline(4, "# Version: V1.0")
call setline(5, "# Author: oldboy")
call setline(6, "# Organization: www.oldboyedu.com")
call setline(7, "##############################################################")
endif
endfunc 二、51cto版本https://blog.51cto.com/thedream/1873060三、自己autocmd BufNewFile *.sh,*.script exec ":call XYY()" 72 function XYY() 73 call append(0,"#!/bin/bash ") 74 call append(1,"#Author: zjz ") 75 call append(2,"#Create_Time:".strftime("%Y-%m-%d" )) 76 call append(3,"#Version:v1.o ") 77 call append(4,"#Mail:1570649754@qq.com ") 78 call append(5,"#Description:useradd ") 79 endfunction