自定义VIM标题

自定义VIM标题

结果演示------

#!/bin/bash

#
#********************************************************************
#Author:                GaoQian
#QQ:                    350080546
#WeChat:                gaoqian350080546
#Date:                  2018-05-27
#FileName:             213.sh
#URL:                   https://blog.csdn.net/faxfac
#Description:          The test script
#Copyright (C):         2018 All rights reserved

#********************************************************************

第一步:

进入root家目录:#cd /root/

[root@localhost ~]#            成功!


第二步:

vim:.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,"#********************************************************************")
        call setline(4,"#Author:                GaoQian")
        call setline(5,"#QQ:                    350080546")
        call setline(6,"#WeChat:                gaoqian350080546")
        call setline(7,"#Date:                  ".strftime("%Y-%m-%d"))
        call setline(8,"#FileName:             ".expand("%"))
        call setline(9,"#URL:                   https://blog.csdn.net/faxfac")
        call setline(10,"#Description:         The test script")
        call setline(11,"#Copyright (C):        ".strftime("%Y")." All rights reserved")
        call setline(12,"#********************************************************************")
        call setline(13,"")
        endif
endfunc

autocmd BufNewFile * normal G  


第一句表示:

                    if expand("%:e") == 'sh'

                    如果判断vim文件名为.sh后缀的。则添加后面行的内容。

第一行:表示shell类型、

第三行:美观标识。

第四行:作者。

第五行:QQ号。

第六行:微信号。

第七行:日期。

第八行:文件名。

第九行:博客网址。

第十行:描述。

第十一行:版权。

以上可以作为vim美观标题。既美观又正规。


猜你喜欢

转载自blog.csdn.net/faxfac/article/details/80472478
今日推荐