Linux的vim自动生成开头

可以在这里生成头 

[root@rocky8 ~]#cat .vimrc
set ts=4
set expandtab
set ignorecase
set shiftwidth=4
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:            laowangnihao1") 
	call setline(5,"#QQ:                704318431") 
	call setline(6,"#Date:              ".strftime("%Y-%m-%d"))
	call setline(7,"#FileName:          ".expand("%"))
	call setline(8,"#URL:               http://www.csdn.com")
	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

你可能感兴趣的:(vim,笔记,运维)