写脚本自动生成行首信息

[16:20:30 root@centos8 ~]#vim .vimrc

set nu
set cursorline
set hlsearch
autocmd BufNeWFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"#")
call setline(3,"#***************************************************************************")
call setline(4,"#Author: zhouchang")
call setline(5,"#QQ: 1520509800")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#Filename: ".expand("%"))
call setline(8,"#URL: https://www.cnblogs.com/shenyuanhaojie/")
call setline(9,"#Description: The test script")
call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(11,"#**************************************************************************")
call setline(12,"")
endif
endfunc
autocmd BufNeWFile * normal G

原文地址:https://www.cnblogs.com/shenyuanhaojie/p/13964566.html