Ⅰ. 插件描述
Loads a template file and does customizable processing when editing a new file.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/template-file-loader'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/template-file-loader'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/template-file-loader'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/template-file-loader
Ⅳ. 文档说明
This plugin is for loading template files when editing new files. A template file will be loaded if found, keywords in that template are expanded, and/or a customized function for that type of files is called.
For all new files, the script checks to see if you have a skeleton (template) file for the extension of that file. For example, ":new temp.c" would check for the existence of "skel.c". Files without extensions are handled also - if you did ":new makefile", the script checks for the existence of "skel.noext.makefile".
skel.* files are looked for in a directory specified with the environment variable $VIMTEMPLATE or in your ~/.vim directory if that env var doesn't exist. This allows you to use mutliple sets of template files - some for work files and some for personal files, for example.
This plugin is meant to be customized - add your own keywords for expansion or your own file specific template functions (example provided in script).
The script includes many example skel.* files - some are links to others.