vimrc(让写文档更容易)

参考如何用VIM快速书写Kubernetes配置清单

编辑~/.vimrc文档

root@qqq:~# vim ~/.vimrc 
root@qqq:~# cat ~/.vimrc 
set ignorecase
set cursorline
set autoindent
set ai
autocmd BufNewFile *.yaml exec ":call SetTitle()"
 
func SetTitle()
        if expand("%:e") == 'yaml'
        call setline(1,"#**************************************************************")
        call setline(2,"#Author:                     uscwifi")
        call setline(3,"#QQ:                         2*******1")
        call setline(4,"#Date:                       ".strftime("%Y-%m-%d"))
        call setline(5,"#FileName:                   ".expand("%"))
        call setline(6,"#URL:                        https://blog.csdn.net/qq_33317586")
        call setline(7,"#Description:                The test script")                                                 
        call setline(8,"#Copyright (C):              ".strftime("%Y")." Copyright ©  站点名称  版权所有")
        call setline(9,"#************************************************************")
        call setline(10,"")
        endif
endfunc
autocmd BufNewFile * normal G

然后编写.yaml格式的文档后就会发现如下,自动加上了描述信息

vimrc(让写文档更容易)_第1张图片

你可能感兴趣的:(CentOS,ubuntu)