https://github.com/melekes/vim-erlang-spec
Generate specifications for your Erlang functions
https://github.com/melekes/vim-erlang-spec
erlang vim-plugin
Last synced: about 1 year ago
JSON representation
Generate specifications for your Erlang functions
- Host: GitHub
- URL: https://github.com/melekes/vim-erlang-spec
- Owner: melekes
- Created: 2015-05-06T19:42:53.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-14T09:51:29.000Z (over 9 years ago)
- Last Synced: 2023-03-22T10:16:08.123Z (over 3 years ago)
- Topics: erlang, vim-plugin
- Language: VimL
- Size: 10.7 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.
[](https://asciinema.org/a/19604?autoplay=1)
## Installation
- [Pathogen][1] `git clone https://github.com/melekes/vim-erlang-spec ~/.vim/bundle/vim-erlang-spec`
- [Vundle][2] `Bundle 'melekes/vim-erlang-spec'`
- [NeoBundle][3] `NeoBundle 'melekes/vim-erlang-spec'`
Add a mapping to your ~/.vimrc (change the key to suit your taste):
nnoremap s :ErlangSpec
## 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](http://learnyousomeerlang.com/types-or-lack-thereof) 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.
[1]: https://github.com/tpope/vim-pathogen
[2]: https://github.com/gmarik/vundle
[3]: https://github.com/Shougo/neobundle.vim