ABOUT
Erlang generic templates for vim
Based on vim-erlang-skeletons and rewritten purely in lua!
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.
You can customize this suite to your needs.
INSTALLATION
{'EliasA5/erlang-skeletons', config = function() require('erlang-skeletons').setup() end},
use 'EliasA5/erlang-skeletons',
Don't forget to call require('erlang-skeletons').setup()
to enable the plugin!
COMMANDS
:ErlServer
Loads gen_server template into current buffer.
:ErlWxObject
Loads wx-object template into current buffer.
:ErlFsm
Loads gen_fsm template into current buffer.
:ErlStatem
Loads gen_statem/3 template into current buffer.
:ErlStatem4
Loads gen_statem/4 template into current buffer.
:ErlSupervisor
Loads supervisor template into current buffer.
:ErlSupervisorBridge
Loads supervisor_bridge 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.
:ErlCTSuite
Loads commontest 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 the logged in user real name or whoami
$company
Defaults to $author if undefined
$fulldate
Defaults to lua os.date("%d %B %Y") (day Month year).
$year
Defaults to lua os.date("%Y")
CONFIGURATION
Following variables can be overrided via init.lua settings:
erl_author
default: logged in user real name or whoami
erl_company
default: vim.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 lua entries:
vim.g.erl_author = "Herp Derp"
vim.g.erl_company = "Me Gusta Inc"
vim.g.erl_replace_buffer = 1
vim.g.erl_tpl_dir = "/home/herp/erlang/templates"
CONTRIBUTE
Feel free to suggest any improvements or extensions at project's github: