Fork me on GitHub

vimrc

autocmd BufNewFile *.py,*.sh, exec ":call SetTitle()"
let $author_name = "xxxx"
let $author_email = "xxxx@xxx.xx"

func SetTitle()
if &filetype == 'sh'
call setline(1,"\###################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ".$author_name)
call append(line(".")+2, "\# mail: ".$author_email)
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#=============================================================")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1,"\###################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ".$author_name)
call append(line(".")+2, "\# mail: ".$author_email)
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#=============================================================")
call append(line(".")+5, "\#!/usr/bin/python")
call append(line(".")+6, "")
endif
endfunc

  

posted on 2017-06-05 09:58  vmaze  阅读(91)  评论(0编辑  收藏  举报

导航