Ⅰ. 插件描述
Erlang generic templates for vim (commands)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'vim-erlang/vim-erlang-skeletons-treacherous'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'vim-erlang/vim-erlang-skeletons-treacherous'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'vim-erlang/vim-erlang-skeletons-treacherous'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-erlang/vim-erlang-skeletons
Ⅳ. 文档说明
ABOUT
Erlang generic templates for vim
INTRODUCTION
This plugin provides a quick access to Erlang templates, such as gen_server,
get_event etc.
The default templates are ripped out of emacs.
This plugin requires your vim to be compiled with Python support.
You can customize this suite to your needs.
This plugin works well with pathogen (https://github.com/tpope/vim-pathogen).
Make sure you call #pathogen:helptags() to enjoy vim help pages for this
plugin.
ALTERNATE VERSION (VimL)
If you don't like the idea of having Python installed, there's a pure VimL
fork here: https://github.com/jimenezrick/vimerl/tree/master/plugin
COMMANDS
:ErlServer Loads gen_server template into current buffer.
:ErlFsm Loads gen_fsm template into current buffer.
:ErlStatem Loads gen_statem template into current buffer.
:ErlSupervisor Loads supervisor template into current buffer.
:ErlEvent Loads gen_event template into current buffer.
:ErlApplication Loads application template into current buffer.
:ErlEscript Loads escript template into current buffer.
:ErlTemplate [arg] Loads [arg] template into current buffer.
TEMPLATES
Templates are plain text files containing special placeholders that start
with dollar sign.
Example:
-module($basename)
VARIABLES
Variables used are:
$basename Current buffer's filename without extension. Defaults to 'untitled' for an unnamed buffer.
$author Defaults to whoami if undefined
$company Defaults to $author if undefined
$fulldate Defaults to python's datetime.now()
$year Defaults to python's datetime.now().year
CONFIGURATION
Following variables can be overrided via .vimrc settings:
erl_author default: whoami
erl_company default: g:erl_author
erl_replace_buffer default: 0. If "1", will erase current buffer after a template insertion command is triggered.
erl_tpl_dir default: Plugin directory concatenated with "/templates". Allows you to use your own template directory. Note, that commands will raise errors, if hardcoded template files doesn't exist there.
Example .vimrc entries:
let g:erl_author="Herp Derp"
let g:erl_company="Me Gusta Inc"
let g:erl_replace_buffer=1
let g:erl_tpl_dir="/home/herp/erlang/templates"
CONTRIBUTE
Feel free to suggest any improvements or extensions at project's github:
https://github.com/vim-erlang/vim-erlang-skeletons