一、李导版本 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