vim 新建文件添加模板

$ vi ~/.vim/sh_header.temp


Custom Header Template for Scripts
#!/bin/bash 
###################################################################
#Script Name    :                                                                                              
#Description    :                                                                                 
#Args           :                                                                                           
#Author           :usename                                               
#Email             :[email protected]                                           
###################################################################

Configure autocmd in Vimrc File

vi  ~/.vimrc  #添加以下内容

au bufnewfile *.sh 0r /home/aaronkilik/.vim/sh_header.temp

解释:

.au – means autocmd
.bufnewfile – event for opening a file that doesn’t exist for editing.
.*.sh – consider all files with .sh extension.

猜你喜欢

转载自my.oschina.net/zhiyonghe/blog/1628727