Ⅰ. 插件描述
A template based commandline file-header generatorⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'harish2704/file-header'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'harish2704/file-header'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'harish2704/file-header'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/harish2704/file-header
Ⅳ. 文档说明
# file-header
A CLI tool for generating file header from a configuration file and an EJS template.
Installation
install the package
npm i -g file-header
Edit the config file ( Optional )
Data to be presented on a file header is stored in a config file which is located at ~/.file-headers/template_data.js
The default content of this file will be as follows.
module.exports = {
user: process.env.USER,
email: process.env.USER + '@' + process.env.HOST,
date: new Date(),
};
We can customize it as required. For example, change it to
module.exports = {
user: 'Jake sully'
email: 'gmail@jakesully.com'
github: 'https://github.com/jakesully'
date: new Date(),
};Edit the EJS tempalte of the default file-header ( Optional )
The default file header template can be found at ~/.file-headers/default
It is just EJS template. We can customize it to any extend.
If we require different template for each file type , create a file ~/.file-headers/<extention>
- For javscript, create a custom template at
~/.file-headers/jsand customize it. - If we want a custom header for '*.spec.js' file, create ~/.file-headers/spec.js and customize it
Usage
Commandline
file-header <filename.ext>which will print the file header to your console.
Use with Vim editor
Add the below line to your vim config file
command! Header :execute '0r!file-header %'Now, type :Header to add file header to your current buffer.