Ⅰ. 插件描述
Generate specifications for your Erlang functionsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'akalyaev/erlang-spec-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'akalyaev/erlang-spec-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'akalyaev/erlang-spec-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/akalyaev/vim-erlang-spec
Ⅳ. 文档说明
# vim-erlang-spec
Generate specifications for your Erlang functions.
When you are inside the function, call :ErlangSpec and this script will
produce specification for it. It won't fill in the argument types for you,
though.
Installation
- Pathogen
git clone https://github.com/melekes/vim-erlang-spec ~/.vim/bundle/vim-erlang-spec - Vundle
Bundle 'melekes/vim-erlang-spec' - NeoBundle
NeoBundle 'melekes/vim-erlang-spec'
Add a mapping to your ~/.vimrc (change the key to suit your taste):
nnoremap <leader>s :ErlangSpec<CR>
Alternative way - TypEr
If you are new to Erlang, you may be not aware of TypEr - tool, which can be
used to generate type annotations for functions. You can read about it
here or in the "Erlang
Programming" book ("TypEr: Success Types and Type Inference").
TODO
- [ ] transform record to record type (
#person{name=Name}=>#person{}) - [ ] parse
is_integerand other simple guards in when block (f(N, _) when is_integer(N)=>f(N, _) -> any() when N :: integer())
Any comments or suggestions? Feel free to open an issue and we will discuss them.
