diff --git a/nvim/apidef.go b/nvim/apidef.go index ba3a1519..1e8c6579 100644 --- a/nvim/apidef.go +++ b/nvim/apidef.go @@ -42,6 +42,26 @@ func BufferLines(buffer Buffer, start int, end int, strict bool) [][]byte { name(nvim_buf_get_lines) } +// AttachBuffer activate updates from this buffer to the current channel. +// +// If sendBuffer is true, initial notification should contain the whole buffer. +// If false, the first notification will be a `nvim_buf_lines_event`. +// Otherwise, the first notification will be a `nvim_buf_changedtick_event` +// +// opts is optional parameters. Currently not used. +// +// returns whether the updates couldn't be enabled because the buffer isn't loaded or opts contained an invalid key. +func AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}) bool { + name(nvim_buf_attach) +} + +// DetachBuffer deactivate updates from this buffer to the current channel. +// +// returns whether the updates couldn't be disabled because the buffer isn't loaded. +func DetachBuffer(buffer Buffer) bool { + name(nvim_buf_detach) +} + // SetBufferLines replaces a line range on a buffer. // // Indexing is zero-based, end-exclusive. Negative indices are interpreted as @@ -72,6 +92,13 @@ func BufferKeyMap(buffer Buffer, mode string) []*Mapping { name(nvim_buf_get_keymap) } +// BufferCommands gets a map of buffer-local user-commands. +// +// opts is optional parameters. Currently not used. +func BufferCommands(buffer Buffer, opts map[string]interface{}) map[string]*Command { + name(nvim_buf_get_commands) +} + // SetBufferVar sets a buffer-scoped (b:) variable. func SetBufferVar(buffer Buffer, name string, value interface{}) { name(nvim_buf_set_var) @@ -95,7 +122,7 @@ func SetBufferOption(buffer Buffer, name string, value interface{}) { // BufferNumber gets a buffer's number. // -// Deprecated: use int(buffer) to get the buffer's number as an integer. +// Deprecated: Use int(buffer) to get the buffer's number as an integer. func BufferNumber(buffer Buffer) int { name(nvim_buf_get_number) deprecatedSince(2) @@ -112,6 +139,12 @@ func SetBufferName(buffer Buffer, name string) { name(nvim_buf_set_name) } +// IsBufferLoaded Checks if a buffer is valid and loaded. +// See api-buffer for more info about unloaded buffers. +func IsBufferLoaded(buffer Buffer) bool { + name(nvim_buf_is_loaded) +} + // IsBufferValid returns true if the buffer is valid. func IsBufferValid(buffer Buffer) bool { name(nvim_buf_is_valid) @@ -441,10 +474,56 @@ func KeyMap(mode string) []*Mapping { name(nvim_get_keymap) } +// Commands gets a map of global (non-buffer-local) Ex commands. +// Currently only user-commands are supported, not builtin Ex commands. +// +// opts is optional parameters. Currently only supports {"builtin":false}. +func Commands(opts map[string]interface{}) map[string]*Command { + name(nvim_get_commands) +} + func APIInfo() []interface{} { name(nvim_get_api_info) } +// SetClientInfo identify the client for nvim. +// +// Can be called more than once, but subsequent calls will remove earlier info, which should be resent if it is still valid. +// (This could happen if a library first identifies the channel, and a plugin using that library later overrides that info) +func SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes) { + name(nvim_set_client_info) +} + +// ChannelInfo get information about a channel. +func ChannelInfo(channel int) *Channel { + name(nvim_get_chan_info) +} + +// Channels get information about all open channels. +func Channels() []*Channel { + name(nvim_list_chans) +} + +// ParseExpression parse a VimL expression. +func ParseExpression(expr string, flags string, highlight bool) map[string]interface{} { + name(nvim_parse_expression) +} + +// UIs gets a list of dictionaries representing attached UIs. +func UIs() []*UI { + name(nvim_list_uis) +} + +// ProcChildren gets the immediate children of process `pid`. +func ProcChildren(pid int) []*Process { + name(nvim_get_proc_children) +} + +// Proc gets info describing process `pid`. +func Proc(pid int) Process { + name(nvim_get_proc) +} + // WindowBuffer returns the current buffer in a window. func WindowBuffer(window Window) Buffer { name(nvim_win_get_buf) diff --git a/nvim/apiimp.go b/nvim/apiimp.go index 22041bea..b8ac7e61 100644 --- a/nvim/apiimp.go +++ b/nvim/apiimp.go @@ -123,6 +123,50 @@ func (b *Batch) BufferLines(buffer Buffer, start int, end int, strict bool, resu b.call("nvim_buf_get_lines", result, buffer, start, end, strict) } +// AttachBuffer activate updates from this buffer to the current channel. +// +// If sendBuffer is true, initial notification should contain the whole buffer. +// If false, the first notification will be a `nvim_buf_lines_event`. +// Otherwise, the first notification will be a `nvim_buf_changedtick_event` +// +// opts is optional parameters. Currently not used. +// +// returns whether the updates couldn't be enabled because the buffer isn't loaded or opts contained an invalid key. +func (v *Nvim) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}) (bool, error) { + var result bool + err := v.call("nvim_buf_attach", &result, buffer, sendBuffer, opts) + return result, err +} + +// AttachBuffer activate updates from this buffer to the current channel. +// +// If sendBuffer is true, initial notification should contain the whole buffer. +// If false, the first notification will be a `nvim_buf_lines_event`. +// Otherwise, the first notification will be a `nvim_buf_changedtick_event` +// +// opts is optional parameters. Currently not used. +// +// returns whether the updates couldn't be enabled because the buffer isn't loaded or opts contained an invalid key. +func (b *Batch) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}, result *bool) { + b.call("nvim_buf_attach", result, buffer, sendBuffer, opts) +} + +// DetachBuffer deactivate updates from this buffer to the current channel. +// +// returns whether the updates couldn't be disabled because the buffer isn't loaded. +func (v *Nvim) DetachBuffer(buffer Buffer) (bool, error) { + var result bool + err := v.call("nvim_buf_detach", &result, buffer) + return result, err +} + +// DetachBuffer deactivate updates from this buffer to the current channel. +// +// returns whether the updates couldn't be disabled because the buffer isn't loaded. +func (b *Batch) DetachBuffer(buffer Buffer, result *bool) { + b.call("nvim_buf_detach", result, buffer) +} + // SetBufferLines replaces a line range on a buffer. // // Indexing is zero-based, end-exclusive. Negative indices are interpreted as @@ -187,6 +231,22 @@ func (b *Batch) BufferKeyMap(buffer Buffer, mode string, result *[]*Mapping) { b.call("nvim_buf_get_keymap", result, buffer, mode) } +// BufferCommands gets a map of buffer-local user-commands. +// +// opts is optional parameters. Currently not used. +func (v *Nvim) BufferCommands(buffer Buffer, opts map[string]interface{}) (map[string]*Command, error) { + var result map[string]*Command + err := v.call("nvim_buf_get_commands", &result, buffer, opts) + return result, err +} + +// BufferCommands gets a map of buffer-local user-commands. +// +// opts is optional parameters. Currently not used. +func (b *Batch) BufferCommands(buffer Buffer, opts map[string]interface{}, result *map[string]*Command) { + b.call("nvim_buf_get_commands", result, buffer, opts) +} + // SetBufferVar sets a buffer-scoped (b:) variable. func (v *Nvim) SetBufferVar(buffer Buffer, name string, value interface{}) error { return v.call("nvim_buf_set_var", nil, buffer, name, value) @@ -231,7 +291,7 @@ func (b *Batch) SetBufferOption(buffer Buffer, name string, value interface{}) { // BufferNumber gets a buffer's number. // -// Deprecated: use int(buffer) to get the buffer's number as an integer. +// Deprecated: Use int(buffer) to get the buffer's number as an integer. func (v *Nvim) BufferNumber(buffer Buffer) (int, error) { var result int err := v.call("nvim_buf_get_number", &result, buffer) @@ -240,7 +300,7 @@ func (v *Nvim) BufferNumber(buffer Buffer) (int, error) { // BufferNumber gets a buffer's number. // -// Deprecated: use int(buffer) to get the buffer's number as an integer. +// Deprecated: Use int(buffer) to get the buffer's number as an integer. func (b *Batch) BufferNumber(buffer Buffer, result *int) { b.call("nvim_buf_get_number", result, buffer) } @@ -269,6 +329,20 @@ func (b *Batch) SetBufferName(buffer Buffer, name string) { b.call("nvim_buf_set_name", nil, buffer, name) } +// IsBufferLoaded Checks if a buffer is valid and loaded. +// See api-buffer for more info about unloaded buffers. +func (v *Nvim) IsBufferLoaded(buffer Buffer) (bool, error) { + var result bool + err := v.call("nvim_buf_is_loaded", &result, buffer) + return result, err +} + +// IsBufferLoaded Checks if a buffer is valid and loaded. +// See api-buffer for more info about unloaded buffers. +func (b *Batch) IsBufferLoaded(buffer Buffer, result *bool) { + b.call("nvim_buf_is_loaded", result, buffer) +} + // IsBufferValid returns true if the buffer is valid. func (v *Nvim) IsBufferValid(buffer Buffer) (bool, error) { var result bool @@ -975,6 +1049,24 @@ func (b *Batch) KeyMap(mode string, result *[]*Mapping) { b.call("nvim_get_keymap", result, mode) } +// Commands gets a map of global (non-buffer-local) Ex commands. +// Currently only user-commands are supported, not builtin Ex commands. +// +// opts is optional parameters. Currently only supports {"builtin":false}. +func (v *Nvim) Commands(opts map[string]interface{}) (map[string]*Command, error) { + var result map[string]*Command + err := v.call("nvim_get_commands", &result, opts) + return result, err +} + +// Commands gets a map of global (non-buffer-local) Ex commands. +// Currently only user-commands are supported, not builtin Ex commands. +// +// opts is optional parameters. Currently only supports {"builtin":false}. +func (b *Batch) Commands(opts map[string]interface{}, result *map[string]*Command) { + b.call("nvim_get_commands", result, opts) +} + func (v *Nvim) APIInfo() ([]interface{}, error) { var result []interface{} err := v.call("nvim_get_api_info", &result) @@ -985,6 +1077,94 @@ func (b *Batch) APIInfo(result *[]interface{}) { b.call("nvim_get_api_info", result) } +// SetClientInfo identify the client for nvim. +// +// Can be called more than once, but subsequent calls will remove earlier info, which should be resent if it is still valid. +// (This could happen if a library first identifies the channel, and a plugin using that library later overrides that info) +func (v *Nvim) SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes) error { + return v.call("nvim_set_client_info", nil, name, version, typ, methods, attributes) +} + +// SetClientInfo identify the client for nvim. +// +// Can be called more than once, but subsequent calls will remove earlier info, which should be resent if it is still valid. +// (This could happen if a library first identifies the channel, and a plugin using that library later overrides that info) +func (b *Batch) SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes) { + b.call("nvim_set_client_info", nil, name, version, typ, methods, attributes) +} + +// ChannelInfo get information about a channel. +func (v *Nvim) ChannelInfo(channel int) (*Channel, error) { + var result *Channel + err := v.call("nvim_get_chan_info", &result, channel) + return result, err +} + +// ChannelInfo get information about a channel. +func (b *Batch) ChannelInfo(channel int, result **Channel) { + b.call("nvim_get_chan_info", result, channel) +} + +// Channels get information about all open channels. +func (v *Nvim) Channels() ([]*Channel, error) { + var result []*Channel + err := v.call("nvim_list_chans", &result) + return result, err +} + +// Channels get information about all open channels. +func (b *Batch) Channels(result *[]*Channel) { + b.call("nvim_list_chans", result) +} + +// ParseExpression parse a VimL expression. +func (v *Nvim) ParseExpression(expr string, flags string, highlight bool) (map[string]interface{}, error) { + var result map[string]interface{} + err := v.call("nvim_parse_expression", &result, expr, flags, highlight) + return result, err +} + +// ParseExpression parse a VimL expression. +func (b *Batch) ParseExpression(expr string, flags string, highlight bool, result *map[string]interface{}) { + b.call("nvim_parse_expression", result, expr, flags, highlight) +} + +// UIs gets a list of dictionaries representing attached UIs. +func (v *Nvim) UIs() ([]*UI, error) { + var result []*UI + err := v.call("nvim_list_uis", &result) + return result, err +} + +// UIs gets a list of dictionaries representing attached UIs. +func (b *Batch) UIs(result *[]*UI) { + b.call("nvim_list_uis", result) +} + +// ProcChildren gets the immediate children of process `pid`. +func (v *Nvim) ProcChildren(pid int) ([]*Process, error) { + var result []*Process + err := v.call("nvim_get_proc_children", &result, pid) + return result, err +} + +// ProcChildren gets the immediate children of process `pid`. +func (b *Batch) ProcChildren(pid int, result *[]*Process) { + b.call("nvim_get_proc_children", result, pid) +} + +// Proc gets info describing process `pid`. +func (v *Nvim) Proc(pid int) (Process, error) { + var result Process + err := v.call("nvim_get_proc", &result, pid) + return result, err +} + +// Proc gets info describing process `pid`. +func (b *Batch) Proc(pid int, result *Process) { + b.call("nvim_get_proc", result, pid) +} + // WindowBuffer returns the current buffer in a window. func (v *Nvim) WindowBuffer(window Window) (Buffer, error) { var result Buffer diff --git a/nvim/apitool.go b/nvim/apitool.go index 0728e86e..dcf1cc89 100644 --- a/nvim/apitool.go +++ b/nvim/apitool.go @@ -305,8 +305,14 @@ var nvimTypes = map[string]string{ "int": "Integer", "interface{}": "Object", "string": "String", + "Process": "Object", "map[string]interface{}": "Dictionary", + "map[string]int": "Dictionary", + "map[string]*Command": "Dictionary", + "*ClientVersion": "Dictionary", + "ClientMethods": "Dictionary", + "ClientAttributes": "Dictionary", "[2]int": "ArrayOf(Integer, 2)", "[]Buffer": "ArrayOf(Buffer)", @@ -317,7 +323,11 @@ var nvimTypes = map[string]string{ "Mode": "Dictionary", "*HLAttrs": "Dictionary", + "*Channel": "Dictionary", + "[]*Channel": "Array", "[]*Mapping": "ArrayOf(Dictionary)", + "[]*Process": "Array", + "[]*UI": "Array", } func convertToNvimTypes(f *Function) *Function { @@ -351,9 +361,10 @@ var compareTemplate = template.Must(template.New("").Funcs(template.FuncMap{ // specialAPIs lists API calls that are implemented by hand. var specialAPIs = map[string]bool{ - "nvim_call_atomic": true, - "nvim_call_function": true, - "nvim_execute_lua": true, + "nvim_call_atomic": true, + "nvim_call_function": true, + "nvim_call_dict_function": true, + "nvim_execute_lua": true, } func compareFunctions(functions []*Function) error { diff --git a/nvim/nvim.go b/nvim/nvim.go index 75a678bd..5b1ff57c 100644 --- a/nvim/nvim.go +++ b/nvim/nvim.go @@ -585,6 +585,22 @@ func (b *Batch) Call(fname string, result interface{}, args ...interface{}) { b.call("nvim_call_function", result, fname, args) } +// CallDict calls a vimscript Dictionary function. +func (v *Nvim) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{}) error { + if args == nil { + args = []interface{}{} + } + return v.call("nvim_call_dict_function", result, fname, dict, args) +} + +// CallDict calls a vimscript Dictionary function. +func (b *Batch) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{}) { + if args == nil { + args = []interface{}{} + } + b.call("nvim_call_dict_function", result, fname, dict, args) +} + // ExecuteLua executes a Lua block. func (v *Nvim) ExecuteLua(code string, result interface{}, args ...interface{}) error { if args == nil { @@ -641,51 +657,3 @@ func unmarshalExt(dec *msgpack.Decoder, id int, v interface{}) (int, error) { } return decodeExt(dec.BytesNoCopy()) } - -type Mode struct { - // Mode is the current mode. - Mode string `msgpack:"mode"` - - // Blocking is true if Nvim is waiting for input. - Blocking bool `msgpack:"blocking"` -} - -type HLAttrs struct { - Bold bool `msgpack:"bold,omitempty"` - Underline bool `msgpack:"underline,omitempty"` - Undercurl bool `msgpack:"undercurl,omitempty"` - Italic bool `msgpack:"italic,omitempty"` - Reverse bool `msgpack:"reverse,omitempty"` - Foreground int `msgpack:"foreground,omitempty" empty:"-1"` - Background int `msgpack:"background,omitempty" empty:"-1"` - Special int `msgpack:"special,omitempty" empty:"-1"` -} - -type Mapping struct { - // LHS is the {lhs} of the mapping. - LHS string `msgpack:"lhs"` - - // RHS is the {hrs} of the mapping as typed. - RHS string `msgpack:"rhs"` - - // Silent is 1 for a |:map-silent| mapping, else 0. - Silent int `msgpack:"silent"` - - // Noremap is 1 if the {rhs} of the mapping is not remappable. - NoRemap int `msgpack:"noremap"` - - // Expr is 1 for an expression mapping. - Expr int `msgpack:"expr"` - - // Buffer for a local mapping. - Buffer int `msgpack:"buffer"` - - // SID is the script local ID, used for mappings. - SID int `msgpack:"sid"` - - // Nowait is 1 if map does not wait for other, longer mappings. - NoWait int `msgpack:"nowait"` - - // Mode specifies modes for which the mapping is defined. - Mode string `msgpack:"string"` -} diff --git a/nvim/types.go b/nvim/types.go new file mode 100644 index 00000000..b26eea5e --- /dev/null +++ b/nvim/types.go @@ -0,0 +1,245 @@ +// Copyright 2019 Gary Burd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nvim + +// Mode represents a Nvim's current mode. +type Mode struct { + // Mode is the current mode. + Mode string `msgpack:"mode"` + + // Blocking is true if Nvim is waiting for input. + Blocking bool `msgpack:"blocking"` +} + +// HLAttrs represents a highlight definitions. +type HLAttrs struct { + Bold bool `msgpack:"bold,omitempty"` + Underline bool `msgpack:"underline,omitempty"` + Undercurl bool `msgpack:"undercurl,omitempty"` + Italic bool `msgpack:"italic,omitempty"` + Reverse bool `msgpack:"reverse,omitempty"` + Foreground int `msgpack:"foreground,omitempty" empty:"-1"` + Background int `msgpack:"background,omitempty" empty:"-1"` + Special int `msgpack:"special,omitempty" empty:"-1"` +} + +// Mapping represents a nvim mapping options. +type Mapping struct { + // LHS is the {lhs} of the mapping. + LHS string `msgpack:"lhs"` + + // RHS is the {hrs} of the mapping as typed. + RHS string `msgpack:"rhs"` + + // Silent is 1 for a |:map-silent| mapping, else 0. + Silent int `msgpack:"silent"` + + // Noremap is 1 if the {rhs} of the mapping is not remappable. + NoRemap int `msgpack:"noremap"` + + // Expr is 1 for an expression mapping. + Expr int `msgpack:"expr"` + + // Buffer for a local mapping. + Buffer int `msgpack:"buffer"` + + // SID is the script local ID, used for mappings. + SID int `msgpack:"sid"` + + // Nowait is 1 if map does not wait for other, longer mappings. + NoWait int `msgpack:"nowait"` + + // Mode specifies modes for which the mapping is defined. + Mode string `msgpack:"string"` +} + +// ClientVersion represents a version of client for nvim. +type ClientVersion struct { + // Major major version. (defaults to 0 if not set, for no release yet) + Major int `msgpack:"major,omitempty" empty:"0"` + + // Minor minor version. + Minor int `msgpack:"minor,omitempty"` + + // Patch patch number. + Patch int `msgpack:"patch,omitempty"` + + // Prerelease string describing a prerelease, like "dev" or "beta1". + Prerelease string `msgpack:"prerelease,omitempty"` + + // Commit hash or similar identifier of commit. + Commit string `msgpack:"commit,omitempty"` +} + +// ClientType type of client information. +type ClientType string + +const ( + // RemoteClientType for the client library. + RemoteClientType ClientType = "remote" + + // UIClientType for the gui frontend. + UIClientType ClientType = "ui" + + // EmbedderClientType for the application using nvim as a component, for instance IDE/editor implementing a vim mode. + EmbedderClientType ClientType = "embedder" + + // HostClientType for the plugin host. Typically started by nvim. + HostClientType ClientType = "host" + + // PluginClientType for the single plugin. Started by nvim. + PluginClientType ClientType = "plugin" +) + +// ClientMethod builtin methods in the client. +// +// For a host, this does not include plugin methods which will be discovered later. +// The key should be the method name, the values are dicts with the following (optional) keys. See below. +// +// Further keys might be added in later versions of nvim and unknown keys are thus ignored. +// Clients must only use keys defined in this or later versions of nvim. +type ClientMethod struct { + // Async is defines whether the uses notification request or blocking request. + // + // If true, send as a notification. + // If false, send as a blocking request. + Async bool `msgpack:"async"` + + // NArgs is the number of method arguments. + NArgs ClientMethodNArgs `msgpack:"nargs"` +} + +// ClientMethodNArgs is the number of arguments. Could be a single integer or an array two integers, minimum and maximum inclusive. +type ClientMethodNArgs struct { + // Min is the minimum number of method arguments. + Min int `msgpack:",array"` + + // Max is the maximum number of method arguments. + Max int `msgpack:",array"` +} + +// ClientAttributes informal attributes describing the client. Clients might define their own keys, but the following are suggested. +type ClientAttributes map[string]string + +const ( + // ClientAttributeKeyWebsite Website of client (for instance github repository). + ClientAttributeKeyWebsite = "website" + + // ClientAttributeKeyLicense Informal description of the license, such as "Apache 2", "GPLv3" or "MIT". + ClientAttributeKeyLicense = "license" + + // ClientoAttributeKeyLogo URI or path to image, preferably small logo or icon. .png or .svg format is preferred. + ClientoAttributeKeyLogo = "logo" +) + +// Client represents a identify the client for nvim. +// +// Can be called more than once, but subsequent calls will remove earlier info, which should be resent if it is still valid. +// (This could happen if a library first identifies the channel, and a plugin using that library later overrides that info) +type Client struct { + // Name is short name for the connected client. + Name string `msgpack:"name,omitempty"` + + // Version describes the version, with the following possible keys (all optional). + Version ClientVersion `msgpack:"version,omitempty"` + + // Type is the client type. Must be one of the ClientType type values. + Type ClientType `msgpack:"type,omitempty"` + + // Methods builtin methods in the client. + Methods map[string]*ClientMethod `msgpack:"methods,omitempty"` + + // Attributes is informal attributes describing the client. + Attributes ClientAttributes `msgpack:"attributes,omitempty"` +} + +// Channel information about a channel. +type Channel struct { + // Stream is the stream underlying the channel. + Stream string `msgpack:"stream,omitempty"` + + // Mode is the how data received on the channel is interpreted. + Mode string `msgpack:"mode,omitempty"` + + // Pty is the name of pseudoterminal, if one is used (optional). + Pty string `msgpack:"pty,omitempty"` + + // Buffer is the buffer with connected terminal instance (optional). + Buffer Buffer `msgpack:"buffer,omitempty"` + + // Client is the information about the client on the other end of the RPC channel, if it has added it using nvim_set_client_info (optional). + Client *Client `msgpack:"client,omitempty"` +} + +// Process represents a Proc and ProcChildren functions return type. +type Process struct { + // Name is the name of process command. + Name string `msgpack:"name,omitempty"` + + // PID is the process ID. + PID int `msgpack:"pid,omitempty"` + + // PPID is the parent process ID. + PPID int `msgpack:"ppid,omitempty"` +} + +// UI represents a nvim ui options. +type UI struct { + // Height requested height of the UI + Height int `msgpack:"height,omitempty"` + + // Width requested width of the UI + Width int `msgpack:"width,omitempty"` + + // RGB whether the UI uses rgb colors (false implies cterm colors) + RGB bool `msgpack:"rgb,omitempty"` + + // ExtPopupmenu externalize the popupmenu. + ExtPopupmenu bool `msgpack:"ext_popupmenu,omitempty"` + + // ExtTabline externalize the tabline. + ExtTabline bool `msgpack:"ext_tabline,omitempty"` + + // ExtCmdline externalize the cmdline. + ExtCmdline bool `msgpack:"ext_cmdline,omitempty"` + + // ExtWildmenu externalize the wildmenu. + ExtWildmenu bool `msgpack:"ext_wildmenu,omitempty"` + + // ExtNewgrid use new revision of the grid events. + ExtNewgrid bool `msgpack:"ext_newgrid,omitempty"` + + // ExtHlstate use detailed highlight state. + ExtHlstate bool `msgpack:"ext_hlstate,omitempty"` + + // ChannelID channel id of remote UI (not present for TUI) + ChannelID int `msgpack:"chan,omitempty"` +} + +// Command represents a Neovim Ex command. +type Command struct { + Bang bool `msgpack:"bang"` + Complete string `msgpack:"complete,omitempty"` + Nargs string `msgpack:"nargs"` + Range string `msgpack:"range,omitempty"` + Name string `msgpack:"name"` + ScriptID int `msgpack:"script_id"` + Bar bool `msgpack:"bar"` + Register bool `msgpack:"register"` + Addr string `msgpack:"addr,omitempty"` + Count string `msgpack:"count,omitempty"` + CompleteArg string `msgpack:"complete_arg,omitempty"` + Definition string `msgpack:"definition"` +}