美文网首页shell编程基础
创建脚本时自动添加备注信息

创建脚本时自动添加备注信息

作者: 圆缘1987 | 来源:发表于2018-05-29 15:40 被阅读0次

set ignorecase
set cursorline
set autoindent
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"# ------------------------------------------------------")
call setline(3,"#FileName: ".expand("%"))
call setline(4,"#Revison: 1.0)
call setline(5,"#Date: ".strftime("%Y-%m-%d"))
call setline(6,"#Author: linux-iosers")
call setline(7,"#Email: 427822450@qq.com)
call setline(8,"#Websit: https://www.jianshu.com/u/0a39e0702a38")
call setline(9,"#Description: ".expand("%"))
call setline(10,"# ----------------------------------------------------")
call setline(11,"#Copyright: ".strftime("%Y")." linux-iosers")
call setline(12,"#License: GPL )
call setline(13,"")
endif
endfunc
autocmd BufNewFile * normal G

1.png

相关文章

网友评论

    本文标题:创建脚本时自动添加备注信息

    本文链接:https://www.haomeiwen.com/subject/vxrajftx.html