设置shell脚本自动title

vim ~/.vimrc 在家目录下添加文件 .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,"#Author: LiuMingzhi.com")
call setline(4,"#email: [email protected]")
call setline(5,"#Date: “.strftime(”%Y-%m-%d"))
call setline(6,"#FileName: “.expand(”%"))
call setline(7,"#CSDN: https://blog.csdn.net/weixin_43231324")
call setline(8,"#Description: Annotated script")
call setline(9,"#
")
call setline(10,"")
endif
endfunc
autocmd BufNewFile * normal G

然后保存退出
现在退出编辑一个shell脚本试试吧!

你可能感兴趣的:(shell)