十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
map ms:call TitleDet()'s
function AddTitle()
call append(0,"#!/bin/bash")
call append(1,"##############################################")
call append(2,"#Author: hanye")
call append(3,"#Email: hz7726@163.com")
call append(4,"#Last modified: ".strftime("%Y/%m/%d/%H:%M"))
call append(5,"#Filename: ".expand("%:t"))
call append(6,"#Revision: 0.1")
call append(7,"#Description: ")
call append(8,"#crontab: * * * * * ".expand("%:t"))
call append(9,"#Website: www.hanye")
call append(10,"#License: GPL")
call append(11,"##############################################")
echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endfunction
function UpdateTitle()
normal m'
execute '/#*Last modified:/s@:.*$@\=strftime(":%Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/#*Filename:/s@:.*$@\=":".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
function TitleDet()
let n=1
while n < 7
let line = getline(n)
if line =~ '^\#\s*\S*Last\smodified:\S*.*$'
call UpdateTitle()
return
endif
let n = n + 1
endwhile
call AddTitle()
endfunction
fn + f4/f4 实现一键插入编辑信息