vimrc配置-新建文件时自动生成文件头

 
 auto add file header
autocmd BufNewFile *.py 0r /home/zxkletters/.vim/vim_template/vim_header_for_python
autocmd BufNewFile *.py ks|call FileName()|'s
autocmd BufNewFile *.py ks|call CreatedTime()|'s
 
autocmd BufNewFile *.sh 0r /home/zxkletters/.vim/vim_template/vim_header_for_sh
autocmd BufNewFile *.sh ks|call FileName()|'s
autocmd BufNewFile *.sh ks|call CreatedTime()|'s
 
fun FileName()
let l = 10
else
endif
endfun
 
fun CreatedTime()
let l = 10
else
endif
endfun
 

/home/zxkletters/.vim/vim_template/vim_header_for_python文件内容:

#!/usr/bin/python
# -*- coding: utf-8 -*-
#########################################################################
# File Name:
# Author: zxkletters
# mail: zxkletters@gmail.com
# Created Time:
#########################################################################

/home/zxkletters/.vim/vim_template/vim_header_for_sh文件内容:

#########################################################################
# File Name:
# Author: zxkletters
# mail: zxkletters@gmail.com
# Created Time:
#########################################################################
#!/bin/bash

相关文章:

  • 2021-08-10
  • 2021-11-14
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-07
  • 2022-12-23
  • 2021-07-21
  • 2021-12-11
  • 2021-07-02
相关资源
相似解决方案