設置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腳本試試吧!

發佈了33 篇原創文章 · 獲贊 6 · 訪問量 5300
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章