新建 .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,"#description This is a test shell file") call setline(4,"#Auther: wangxiaopeng") call setline(5,"#QQ: 429551907") call setline(6,"#Date: ".strftime("%Y-%m-%d")) call setline(7,"#FileName: ".expand("%")) call setline(8,"#URL: http://www.cnblogs.com/wxp100/") call setline(9,"#**********************************************") call setline(10," ") endif endfunc autocmd BufNewFile * normal G
放入家目录中 /root