不求甚解

此博客为个人学习之用,如与其他作品雷同,纯属巧合。

导航

自动生成shell注释

Posted on 2021-02-01 13:59  三年三班王小朋  阅读(74)  评论(0编辑  收藏  举报

 新建 .vimrc

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,"#description     This is a test shell file")
           call setline(4,"#Auther:         wangxiaopeng")
           call setline(5,"#QQ:             429551907")
           call setline(6,"#Date:            ".strftime("%Y-%m-%d"))
           call setline(7,"#FileName:        ".expand("%"))
           call setline(8,"#URL:             http://www.cnblogs.com/wxp100/")
           call setline(9,"#**********************************************")
           call setline(10," ")
           endif
endfunc
autocmd BufNewFile * normal G

 放入家目录中  /root