vim /etc/vimrc
一、李导版本
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()"
" ****************************************************************** ")
function XYY()
call append(0,"#!/bin/bash ")
call append(1,"#******************************************")
call append(2,"#Author: zhangjingzhi ")
call append(3,"#Create_Time: ".strftime("%Y-%m-%d" ))
call append(4,"#Version: v1.o ")
call append(5,"#Mail: 1570649754@qq.com ")
call append(6,"#Description: doyouwanttodo ")
call append(7,"#******************************************")
endfunction