Ⅰ. 插件描述
A Vim plugin for starting new documents from a template.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '58bits/boost-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '58bits/boost-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '58bits/boost-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/58bits/boost
Ⅳ. 文档说明
- boost
Vim plugin for creating new files from templates.
- Description
Based on Aristotle Pagaltzis <pagaltis@gmz.de> template script.
"http://www.vim.org/scripts/script.php?script_id=1172":http://www.vim.org/scripts/script.php?script_id=1172
Modified to use .tpl extensions and a filetype definition at the top of the template. The script is no longer automatically executed for a new buffer.
- Usage
In order to tell Vim to use the correct filetype for editing, you must place the following text on the first line of the template:
@# filetype: xhtml@
This will cause the vim filetype to be set to whatever filetype is specified after the colon (xhtml in this case). The filetype definition will then be removed from the newly created buffer.
You can still set the initial curser position in the template as per Aristotle's original script.
To load a template use the 'Boost' command followed by the template name (without the .tpl suffix).
For example:
@:Boost html@ loads the html.tpl template into the current buffer
@:Boost html-strict@ loads the html-strict.tpl template into the current buffer
@:Boost bash@ loads the bash.tpl template into the current buffer
@:Boost mytemplate@ loads the mytemplate.tpl template into the current buffer
- Autocomplete
Thanks to Johannes Deutsch "https://github.com/nichtleiter":https://github.com/nichtleiter for the argument autocomplete feature. Now typing @Boost <tab>@ will show you the available list of templates (on Mac OS X and all *nix boxes).
- Installation
Place boost.vim in your Vim plugins directory (or in your bundle/boost/plugin directory if you are using pathogen).
Then create a 'templates' directory in your .vim directory and place your .tpl templates here. For example a bash.tpl template, or a css.tpl, or any file that you would like to load as a template - as long as it ends in .tpl.
There are sample templates included in the repository.