Smart load template file for Vim.
Put plugin/template.vim
into $VIM/vimfiles/plugin/
for Windows,
or into .vim/plugin/
for *nix.
Put template/template.*
into $VIM/vimfiles/template/
for Windows,
or into .vim/template/
for *nix.
If your vim installed snipMate.vim, append snippets/_.snippet
content
to $VIM/snippets/_.snippet
for Windows,
or to .vim/snippets/_.snippet
for *nix.
:new file.html
:tabnew file.css
If current buffer has been set filetype, you can use command: :Template
.
If your vim installed snipMate.vim plugin, input template<Tab>
to smart load
the template(when the buffer has suffix or &filetype).
If you didn't want auto load template every time, let g:template_autoload = 0
.
Support following placeholder.
${cursor}
- default cursor position.${filename}
- get origin file name.${FileName}
- file-name to File-Name.${FILENAME}
- filename to FILENAME.${date}
- today.${datetime}
- now.${author}
- Needlet g:template_author = "You Name"
in your vimrc.
- 更流畅的支持 Makefile 这类无后缀的文件。
- 一种文件类型支持多个模板。
- 类似 snipMate 的 ${1:default text},支持多个占位符使用 跳转。${0} 等同于 ${cursor}
- 问题:作为模板来说是不是有点过度设计了?
- 可能会与 snipMate 等使用 的插件冲突。
- 类似 snipMate 的自定义占位符特性,由用户自定义类似 ${date} 这类占位符,动态计算其值。 -- 百合仙子
- template.hpp 中防范宏定义重复引入的问题,如果文件名中带有特殊字符会出现 BUG。
- 防范方案 I: 不要使用带有特殊字符的文件名 :)
- 解决方案 II: 实现一个占位符,自动剔除、替换特殊字符。
- 解决方案 III: 也许应该实现由用户自定义占位符的特性?
- VIM学习笔记 模板(Template) - 语虚
- [http:https://www.vim.org/scripts/script.php?script_id=198 template file loader]
- 使用vim的一些tip - 潘魏增
- 快速从模板建立文件 - 明城 [email protected]
- templates.vim : Load filetype templates for new files
- template.vim : Simple and flexible template engine. @github
- work problem with pathogen
- templates.vim
- vimplate.vim
- Vimplate Enhanced
- load_template
- autoloadTemplate.vim