vimrc配置,包含.c文件.h头文件.sh壳文件
在linux终端下敲入 vi ~/.vimrc 即可进入vimrc配置文件
以下内容复制粘贴在vimrc配置文件最后一行即可使用
可以帮你节省时间
autocmd BufNewFile *.py,*.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
func SetTitle()
if &filetype == 'c'
call append(0, "/************************************************************************************************************************************************************************************************************************")
call append(1, " *文件名:".expand("%"))
call append(2, " *作 者: hxy")
call append(3, " *时 间:".strftime("%c"))
call append(4, " *版 本: 1.0")
call append(5, " *作 用:")
call append(6, "****************************************************************************************************************************************************************************************************************************/")
call append(7, "#include
call append(8, "")
call append(9, "int main(int argc,char *argv[])")
call append(10, "{")
call append(12, " return 0;")
call append(13, "}")
endif
if expand("%:e") == 'h'
call append(0, "#ifndef _".toupper(expand("%:r"))."_H")
call append(1, "#define _".toupper(expand("%:r"))."_H")
call append(3, "")
call append(4, "#endif")
endif
if &filetype == 'sh'
call setline(1,"\#****************************************************************************************")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: hxy")
call append(line(".")+2, "\# mail: ")
call append(line(".")+3, "\# Created Time:".strftime("%c"))
call append(line(".")+4, "\#************************************************************************************")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
call append(line(".")+7, "")
endif
endfunc
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
