当新建莫类型文件时,用editplus会有模板文件提供使用,就是会自动生成文档的部分内容。在vim中可以通过autocmd+BufNewFile 来实现静态的模板文件。

1)首先编写模板文件

建立目录~/.vim/template

    makdir ~/.vim/template 

然后编写模板文件

    vim c.tlp 

将需要自动生成的内容插入其内

2)修改vimrc

    autocmd BufNewFile *.c  0r  ~/.vim/template/c.tlp 

这样就开以在新建*.c文件时自动插入内容了。


相关文章:

  • 2021-08-29
  • 2022-12-23
  • 2021-06-29
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-14
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案