编辑~/.vimrc文档
root@qqq:~
root@qqq:~
set ignorecase
set cursorline
set autoindent
set ai
autocmd BufNewFile *.yaml exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'yaml'
call setline(1,"#**************************************************************")
call setline(2,"#Author: uscwifi")
call setline(3,"#QQ: 2*******1")
call setline(4,"#Date: ".strftime("%Y-%m-%d"))
call setline(5,"#FileName: ".expand("%"))
call setline(6,"#URL: https://blog.csdn.net/qq_33317586")
call setline(7,"#Description: The test script")
call setline(8,"#Copyright (C): ".strftime("%Y")." Copyright © 站点名称 版权所有")
call setline(9,"#************************************************************")
call setline(10,"")
endif
endfunc
autocmd BufNewFile * normal G
然后编写.yaml格式的文档后就会发现如下,自动加上了描述信息