Skip to content

melekes/vim-erlang-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

asciicast

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_integer and 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.

About

Generate specifications for your Erlang functions

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published