Define a struct, e.g. example.Example, that implements neovim.Plugin
Via go generate tool, search for //neovim:wrapper Example Method1 directives to see which methods should have wrappers generated
Sync methods will be defined as:
// n args and m ret vals
// requires two error ret vals as last two return values
//neovim:wrapper Example SyncMethod
func (e *Example) SyncMethod(arg1 string, arg2 int, ...) (ret1 string, ret2 int, ..., error, error) {
...
}
Async methods will be defined as:
// n args
// single error ret val
//neovim:wrapper Example AsyncMethod
func (e *Example) AsyncMethod(arg1 string, arg2 int, ...) error {
...
}
Use msgp to generate MSGPACK wrappers around the wrappers
Define neovim methods that can be called during a plugin's Init method to register:
example.Example
, that implementsneovim.Plugin
go generate
tool, search for//neovim:wrapper Example Method1
directives to see which methods should have wrappers generatedmsgp
to generate MSGPACK wrappers around the wrappersneovim
methods that can be called during a plugin'sInit
method to register: