一、先创建单个用户的vim文件(我们只给root在vim的时候自动添加)。
https://blog.csdn.net/qq_32019341/article/details/90741907
[root@123123 nginx]# cat /root/.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,"#Author: XT_TALK")
call setline(4,"#Date: ".strftime("%y-%m-%d"))
call setline(5,"#FileName: ".expand("%"))
call setline(6,"#*************************************************************")
call setline(7,"")
endif
endfunc
autocmd BufNewFile * normal G
##保存 请复制链接的
二、进行测试
有问题请加博主微信进行沟通!
全部评论