编写 .vimrc文件,定制vim环境
/etc/vimrc #全局
~/.vimrc #个人(不建议放在全局)
set ts=4
set expandtab
set ignorecase
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: caoqinglin")
call setline(5,"#phone: 18098948421")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#FileName: ".expand("%"))
call setline(8,"#Description: The test script")
call setline(9,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(10,"#**********************************************************")
call setline(11,"")
endif
endfunc
autocmd BufNewFile * normal G
posted on 2021-06-04 15:47 1251618589 阅读(3) 评论(0) 编辑 收藏 举报