nvim

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 15 Imported by: 114

Documentation

Overview

Package nvim implements a Nvim client.

See the ./plugin package for additional functionality required for writing Nvim plugins.

The Nvim type implements the client. To connect to a running instance of Nvim, create a *Nvim value using the Dial or NewChildProcess functions. Call the Close() method to release the resources used by the client.

Use the Batch type to execute a sequence of Nvim API calls atomically. The Nvim NewBatch method creates new *Batch values.

Example

This program lists the names of the Nvim buffers when run from an Nvim terminal. It dials to Nvim using the $NVIM_LISTEN_ADDRESS and fetches all of the buffer names in one call using a batch.

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/neovim/go-client/nvim"
)

func main() {
	// Get address from environment variable set by Nvim.
	addr := os.Getenv("NVIM_LISTEN_ADDRESS")
	if addr == "" {
		log.Fatal("NVIM_LISTEN_ADDRESS not set")
	}

	// Dial with default options.
	v, err := nvim.Dial(addr)
	if err != nil {
		log.Fatal(err)
	}

	// Cleanup on return.
	defer v.Close()

	bufs, err := v.Buffers()
	if err != nil {
		log.Fatal(err)
	}

	// Get the names using a single atomic call to Nvim.
	names := make([]string, len(bufs))
	b := v.NewBatch()
	for i, buf := range bufs {
		b.BufferName(buf, &names[i])
	}
	if err := b.Execute(); err != nil {
		log.Fatal(err)
	}

	// Print the names.
	for _, name := range names {
		fmt.Println(name)
	}
}

Index

Examples

Constants

View Source
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 = "logo"
)

Variables

This section is empty.

Functions

func NewBufferReader

func NewBufferReader(v *Nvim, b Buffer) io.Reader

NewBufferReader returns a reader for the specified buffer. If b = 0, then the current buffer is used.

Types

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

Batch collects API function calls and executes them atomically.

The function calls in the batch are executed without processing requests from other clients, redrawing or allowing user interaction in between. Functions that could fire autocommands or do event processing still might do so. For instance invoking the :sleep command might call timer callbacks.

Call the Execute() method to execute the commands in the batch. Result parameters in the API function calls are set in the call to Execute. If an API function call fails, all results proceeding the call are set and a *BatchError is returned.

A Batch does not support concurrent calls by the application.

func (*Batch) APIInfo

func (b *Batch) APIInfo(apiInfo *[]interface{})

func (*Batch) AddBufferHighlight

func (b *Batch) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int, id *int)

AddBufferHighlight adds a highlight to buffer and returns the source id of the highlight.

AddBufferHighlight can be used for plugins which dynamically generate highlights to a buffer (like a semantic highlighter or linter). The function adds a single highlight to a buffer. Unlike matchaddpos() highlights follow changes to line numbering (as lines are inserted/removed above the highlighted line), like signs and marks do.

The srcID is useful for batch deletion/updating of a set of highlights. When called with srcID = 0, an unique source id is generated and returned. Successive calls can pass in it as srcID to add new highlights to the same source group. All highlights in the same group can then be cleared with ClearBufferHighlight. If the highlight never will be manually deleted pass in -1 for srcID.

If hlGroup is the empty string no highlight is added, but a new srcID is still returned. This is useful for an external plugin to synchronously request an unique srcID at initialization, and later asynchronously add and clear highlights in response to buffer changes.

The startCol and endCol parameters specify the range of columns to highlight. Use endCol = -1 to highlight to the end of the line.

func (*Batch) AllOptionsInfo added in v1.1.4

func (b *Batch) AllOptionsInfo(opinfo *OptionInfo)

AllOptionsInfo gets the option information for all options.

The dictionary has the full option names as keys and option metadata dictionaries as detailed at OptionInfo.

Resulting map has keys:

name

Name of the option (like 'filetype').

shortname

Shortened name of the option (like 'ft').

type

type of option ("string", "number" or "boolean").

default

The default value for the option.

was_set

Whether the option was set.

last_set_sid

Last set script id (if any).

last_set_linenr

line number where option was set.

last_set_chan

Channel where option was set (0 for local).

scope

one of "global", "win", or "buf".

global_local

whether win or buf option has a global value.

commalist

List of comma separated values.

flaglist

List of single char flags.

func (*Batch) AttachBuffer

func (b *Batch) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}, attached *bool)

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 (*Batch) AttachUI

func (b *Batch) AttachUI(width int, height int, options map[string]interface{})

AttachUI registers the client as a remote UI. After this method is called, the client will receive redraw notifications.

:help rpc-remote-ui

The redraw notification method has variadic arguments. Register a handler for the method like this:

v.RegisterHandler("redraw", func(updates ...[]interface{}) {
    for _, update := range updates {
        // handle update
    }
})

func (*Batch) BufferChangedTick

func (b *Batch) BufferChangedTick(buffer Buffer, changedtick *int)

BufferChangedTick gets a changed tick of a buffer.

func (*Batch) BufferCommands

func (b *Batch) BufferCommands(buffer Buffer, opts map[string]interface{}, result *map[string]*Command)

BufferCommands gets a map of buffer-local user-commands.

opts is optional parameters. Currently not used.

func (*Batch) BufferExtmarkByID added in v1.0.2

func (b *Batch) BufferExtmarkByID(buffer Buffer, nsID int, id int, opt map[string]interface{}, pos *[]int)

BufferExtmarkByID returns position for a given extmark id.

The `opts` is additional options. Supports the string keys are:

limit (value: int)

Maximum number of marks to return.

details (value: bool)

Whether to include the details dict.

func (*Batch) BufferExtmarks added in v1.0.2

func (b *Batch) BufferExtmarks(buffer Buffer, nsID int, start interface{}, end interface{}, opt map[string]interface{}, marks *[]ExtMarks)

BufferExtmarks gets extmarks in "traversal order" from a charwise region defined by buffer positions (inclusive, 0-indexed).

Region can be given as (row,col) tuples, or valid extmark ids (whose positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1) respectively, thus the following are equivalent:

BufferExtmarks(0, myNS, 0, -1, {})
BufferExtmarks(0, myNS, [0,0], [-1,-1], {})

If `end` is less than `start`, traversal works backwards. (Useful with `limit`, to get the first marks prior to a given position.)

The `opts` is additional options. Supports the string keys are:

limit (value: int)

Maximum number of marks to return.

details (value: bool)

Whether to include the details dict.

func (*Batch) BufferKeyMap

func (b *Batch) BufferKeyMap(buffer Buffer, mode string, result *[]*Mapping)

BufferKeymap gets a list of buffer-local mappings.

The mode short-name ("n", "i", "v", ...).

func (*Batch) BufferLineCount

func (b *Batch) BufferLineCount(buffer Buffer, count *int)

BufferLineCount returns the number of lines in the buffer.

func (*Batch) BufferLines

func (b *Batch) BufferLines(buffer Buffer, start int, end int, strict bool, lines *[][]byte)

BufferLines retrieves a line range from a buffer.

Indexing is zero-based, end-exclusive. Negative indices are interpreted as length+1+index, i e -1 refers to the index past the end. So to get the last element set start=-2 and end=-1.

Out-of-bounds indices are clamped to the nearest valid value, unless strict = true.

func (*Batch) BufferMark

func (b *Batch) BufferMark(buffer Buffer, name string, pos *[2]int)

BufferMark returns the (row,col) of the named mark.

func (*Batch) BufferName

func (b *Batch) BufferName(buffer Buffer, name *string)

BufferName gets the full file name of a buffer.

func (*Batch) BufferNumber deprecated

func (b *Batch) BufferNumber(buffer Buffer, number *int)

BufferNumber gets a buffer's number.

Deprecated: Use int(buffer) to get the buffer's number as an integer.

func (*Batch) BufferOffset

func (b *Batch) BufferOffset(buffer Buffer, index int, offset *int)

BufferOffset returns the byte offset for a line.

Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte. 'fileformat' and 'fileencoding' are ignored. The line index just after the last line gives the total byte-count of the buffer. A final EOL byte is counted if it would be written, see 'eol'.

Unlike |line2byte()|, throws error for out-of-bounds indexing. Returns -1 for unloaded buffer.

func (*Batch) BufferOption

func (b *Batch) BufferOption(buffer Buffer, name string, result interface{})

BufferOption gets a buffer option value.

func (*Batch) BufferVar

func (b *Batch) BufferVar(buffer Buffer, name string, result interface{})

BufferVar gets a buffer-scoped (b:) variable.

func (*Batch) Buffers

func (b *Batch) Buffers(buffers *[]Buffer)

Buffers returns the current list of buffers.

func (*Batch) Call

func (b *Batch) Call(fname string, result interface{}, args ...interface{})

Call calls a vimscript function.

func (*Batch) CallDict

func (b *Batch) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{})

CallDict calls a vimscript Dictionary function.

func (*Batch) ChannelInfo

func (b *Batch) ChannelInfo(channelID int, channel *Channel)

ChannelInfo get information about a channel.

func (*Batch) Channels

func (b *Batch) Channels(channels *[]*Channel)

Channels get information about all open channels.

func (*Batch) ClearBufferHighlight deprecated

func (b *Batch) ClearBufferHighlight(buffer Buffer, srcID int, startLine int, endLine int)

ClearBufferHighlight clears highlights from a given source group and a range of lines.

To clear a source group in the entire buffer, pass in 1 and -1 to startLine and endLine respectively.

The lineStart and lineEnd parameters specify the range of lines to clear. The end of range is exclusive. Specify -1 to clear to the end of the file.

Deprecated: Use ClearBufferNamespace() instead.

func (*Batch) ClearBufferNamespace

func (b *Batch) ClearBufferNamespace(buffer Buffer, nsID int, lineStart int, lineEnd int)

ClearBufferNamespace clears namespaced objects, highlights and virtual text, from a line range.

To clear the namespace in the entire buffer, pass in 0 and -1 to line_start and line_end respectively.

func (*Batch) CloseWindow

func (b *Batch) CloseWindow(window Window, force bool)

CloseWindow close a window.

This is equivalent to |:close| with count except that it takes a window id.

func (*Batch) ColorByName

func (b *Batch) ColorByName(name string, color *int)

ColorByName returns the 24-bit RGB value of a ColorMap color name or `#rrggbb` hexadecimal string.

func (*Batch) ColorMap

func (b *Batch) ColorMap(colorMap *map[string]int)

ColorMap returns a map of color names and RGB values.

Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values (e.g. 65535).

The returns map is color names and RGB values.

func (*Batch) Command

func (b *Batch) Command(cmd string)

Command executes a single ex command.

func (*Batch) CommandOutput deprecated

func (b *Batch) CommandOutput(cmd string, out *string)

CommandOutput executes a single ex command and returns the output.

Deprecated: Use Exec() instead.

func (*Batch) Commands

func (b *Batch) Commands(opts map[string]interface{}, commands *map[string]*Command)

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 (*Batch) Context added in v1.0.2

func (b *Batch) Context(opts map[string][]string, contexts *map[string]interface{})

Context gets a map of the current editor state. This API still under development.

The `opts` is optional parameters.

types

List of context-types to gather, or empty for all context.

regs
jumps
bufs
gvars
funcs
sfuncs

func (*Batch) CreateBuffer

func (b *Batch) CreateBuffer(listed bool, scratch bool, buffer *Buffer)

CreateBuffer creates a new, empty, unnamed buffer.

func (*Batch) CreateNamespace

func (b *Batch) CreateNamespace(name string, nsID *int)

CreateNamespace creates a new namespace, or gets an existing one.

Namespaces are used for buffer highlights and virtual text, see AddBufferHighlight() and SetBufferVirtualText().

Namespaces can be named or anonymous. If `name` matches an existing namespace, the associated id is returned. If `name` is an empty string a new, anonymous namespace is created.

The returns the namespace ID.

func (*Batch) CurrentBuffer

func (b *Batch) CurrentBuffer(buffer *Buffer)

CurrentBuffer returns the current buffer.

func (*Batch) CurrentLine

func (b *Batch) CurrentLine(line *[]byte)

CurrentLine gets the current line in the current buffer.

func (*Batch) CurrentTabpage

func (b *Batch) CurrentTabpage(tabpage *Tabpage)

CurrentTabpage returns the current tabpage.

func (*Batch) CurrentWindow

func (b *Batch) CurrentWindow(window *Window)

CurrentWindow returns the current window.

func (*Batch) DeleteBuffer added in v1.1.4

func (b *Batch) DeleteBuffer(buffer Buffer, opts map[string]bool)

DeleteBuffer deletes the buffer.

See:

:help bwipeout

The `opts` is additional options. Supports the key:

force

Force deletion and ignore unsaved changes.

unload

Unloaded only, do not delete. See :help bunload.

func (*Batch) DeleteBufferExtmark added in v1.0.2

func (b *Batch) DeleteBufferExtmark(buffer Buffer, nsID int, extmarkID int, deleted *bool)

DeleteBufferExtmark removes an extmark.

func (*Batch) DeleteBufferKeyMap added in v1.0.1

func (b *Batch) DeleteBufferKeyMap(buffer Buffer, mode string, lhs string)

DeleteBufferKeyMap unmaps a buffer-local mapping for the given mode.

See:

:help nvim_del_keymap()

func (*Batch) DeleteBufferVar

func (b *Batch) DeleteBufferVar(buffer Buffer, name string)

DeleteBufferVar removes a buffer-scoped (b:) variable.

func (*Batch) DeleteCurrentLine

func (b *Batch) DeleteCurrentLine()

DeleteCurrentLine deletes the current line in the current buffer.

func (*Batch) DeleteKeyMap added in v1.0.1

func (b *Batch) DeleteKeyMap(mode string, lhs string)

DeleteKeyMap unmaps a global mapping for the given mode.

To unmap a buffer-local mapping, use DeleteBufferKeyMap().

See:

:help nvim_set_keymap()

func (*Batch) DeleteTabpageVar

func (b *Batch) DeleteTabpageVar(tabpage Tabpage, name string)

DeleteTabpageVar removes a tab-scoped (t:) variable.

func (*Batch) DeleteVar

func (b *Batch) DeleteVar(name string)

DeleteVar removes a global (g:) variable.

func (*Batch) DeleteWindowVar

func (b *Batch) DeleteWindowVar(window Window, name string)

DeleteWindowVar removes a window-scoped (w:) variable.

func (*Batch) DetachBuffer

func (b *Batch) DetachBuffer(buffer Buffer, detached *bool)

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 (*Batch) DetachUI

func (b *Batch) DetachUI()

DetachUI unregisters the client as a remote UI.

func (*Batch) Echo added in v1.1.6

func (b *Batch) Echo(chunks []EchoChunk, history bool, opts map[string]interface{})

Echo echo a message.

The chunks is a list of [text, hl_group] arrays, each representing a text chunk with specified highlight. hl_group element can be omitted for no highlight.

If history is true, add to |message-history|.

The opts arg is optional parameters. Reserved for future use.

func (*Batch) Eval

func (b *Batch) Eval(expr string, result interface{})

Eval evaluates the expression expr using the Vim internal expression evaluator.

:help expression

func (*Batch) Exec added in v1.0.2

func (b *Batch) Exec(src string, output bool, out *string)

Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.

func (*Batch) ExecLua added in v1.0.2

func (b *Batch) ExecLua(code string, result interface{}, args ...interface{})

ExecLua executes a Lua block.

func (*Batch) Execute

func (b *Batch) Execute() error

Execute executes the API function calls in the batch.

func (*Batch) ExecuteLua deprecated

func (b *Batch) ExecuteLua(code string, result interface{}, args ...interface{})

ExecuteLua executes a Lua block.

Deprecated: Use ExecLua() instead.

func (*Batch) FeedKeys

func (b *Batch) FeedKeys(keys string, mode string, escapeCSI bool)

FeedKeys Pushes keys to the Nvim user input buffer. Options can be a string with the following character flags:

m

Remap keys. This is default.

n

Do not remap keys.

t

Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, opening folds, etc.

func (*Batch) HLByID

func (b *Batch) HLByID(id int, rgb bool, highlight *HLAttrs)

HLByID gets a highlight definition by id.

func (*Batch) HLByName

func (b *Batch) HLByName(name string, rgb bool, highlight *HLAttrs)

HLByName gets a highlight definition by name.

func (*Batch) HLIDByName added in v1.0.2

func (b *Batch) HLIDByName(name string, highlightID *int)

HLIDByName gets a highlight group by name.

func (*Batch) Input

func (b *Batch) Input(keys string, written *int)

Input pushes bytes to the Nvim low level input buffer.

Unlike FeedKeys, this uses the lowest level input buffer and the call is not deferred. It returns the number of bytes actually written(which can be less than what was requested if the buffer is full).

func (*Batch) InputMouse

func (b *Batch) InputMouse(button string, action string, modifier string, grid int, row int, col int)

InputMouse send mouse event from GUI.

The call is non-blocking. It doesn't wait on any resulting action, but queues the event to be processed soon by the event loop.

func (*Batch) IsBufferLoaded

func (b *Batch) IsBufferLoaded(buffer Buffer, loaded *bool)

IsBufferLoaded Checks if a buffer is valid and loaded. See api-buffer for more info about unloaded buffers.

func (*Batch) IsBufferValid

func (b *Batch) IsBufferValid(buffer Buffer, valied *bool)

IsBufferValid returns true if the buffer is valid.

func (*Batch) IsTabpageValid

func (b *Batch) IsTabpageValid(tabpage Tabpage, valid *bool)

IsTabpageValid checks if a tab page is valid.

func (*Batch) IsWindowValid

func (b *Batch) IsWindowValid(window Window, valid *bool)

IsWindowValid returns true if the window is valid.

func (*Batch) KeyMap

func (b *Batch) KeyMap(mode string, maps *[]*Mapping)

KeyMap gets a list of global (non-buffer-local) mapping definitions.

The mode arg is the mode short-name, like `n`, `i`, `v` or etc.

func (*Batch) LoadContext added in v1.0.2

func (b *Batch) LoadContext(dict map[string]interface{}, result interface{})

LoadContext sets the current editor state from the given context map.

func (*Batch) Mode

func (b *Batch) Mode(mode *Mode)

Mode gets Nvim's current mode.

func (*Batch) Namespaces

func (b *Batch) Namespaces(namespaces *map[string]int)

Namespaces gets existing named namespaces.

The return dict that maps from names to namespace ids.

func (*Batch) OpenWindow

func (b *Batch) OpenWindow(buffer Buffer, enter bool, config *WindowConfig, window *Window)

OpenWindow opens a new window.

Currently this is used to open floating and external windows. Floats are windows that are drawn above the split layout, at some anchor position in some other window. Floats can be drawn internally or by external GUI with the |ui-multigrid| extension. External windows are only supported with multigrid GUIs, and are displayed as separate top-level windows.

For a general overview of floats, see |api-floatwin|.

Exactly one of External and Relative must be specified. The Width and Height of the new window must be specified.

With relative=editor (row=0,col=0) refers to the top-left corner of the screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right corner. Fractional values are allowed, but the builtin implementation (used by non-multigrid UIs) will always round down to nearest integer.

Out-of-bounds values, and configurations that make the float not fit inside the main editor, are allowed. The builtin implementation truncates values so floats are fully within the main screen grid. External GUIs could let floats hover outside of the main window like a tooltip, but this should not be used to specify arbitrary WM screen positions.

The returns the window handle or 0 when error.

func (*Batch) Option

func (b *Batch) Option(name string, result interface{})

Option gets an option.

func (*Batch) OptionInfo added in v1.1.4

func (b *Batch) OptionInfo(name string, opinfo *OptionInfo)

OptionInfo Gets the option information for one option.

Resulting dictionary has keys:

name

Name of the option (like 'filetype').

shortname

Shortened name of the option (like 'ft').

type

type of option ("string", "number" or "boolean").

default

The default value for the option.

was_set

Whether the option was set.

last_set_sid

Last set script id (if any).

last_set_linenr

line number where option was set.

last_set_chan

Channel where option was set (0 for local).

scope

one of "global", "win", or "buf".

global_local

whether win or buf option has a global value.

commalist

List of comma separated values.

flaglist
List of single char flags.

func (*Batch) ParseExpression

func (b *Batch) ParseExpression(expr string, flags string, highlight bool, expression *map[string]interface{})

ParseExpression parse a VimL expression.

func (*Batch) Paste added in v1.0.2

func (b *Batch) Paste(data string, crlf bool, phase int, state *bool)

Paste pastes at cursor, in any mode.

Invokes the `vim.paste` handler, which handles each mode appropriately. Sets redo/undo. Faster than Input(). Lines break at LF ("\n").

Errors (`nomodifiable`, `vim.paste()` `failure` ...) are reflected in `err` but do not affect the return value (which is strictly decided by `vim.paste()`).

On error, subsequent calls are ignored ("drained") until the next paste is initiated (phase 1 or -1).

data

multiline input. May be binary (containing NUL bytes).

crlf

also break lines at CR and CRLF.

phase

-1 is paste in a single call (i.e. without streaming).

To `stream` a paste, call Paste sequentially with these `phase` args:

1

starts the paste (exactly once)

2

continues the paste (zero or more times)

3

ends the paste (exactly once)

The returned boolean state is:

true

Client may continue pasting.

false

Client must cancel the paste.

func (*Batch) Proc

func (b *Batch) Proc(pid int, process *Process)

Proc gets info describing process `pid`.

func (*Batch) ProcChildren

func (b *Batch) ProcChildren(pid int, processes *[]*Process)

ProcChildren gets the immediate children of process `pid`.

func (*Batch) Put added in v1.0.2

func (b *Batch) Put(lines []string, typ string, after bool, follow bool)

Put puts text at cursor, in any mode.

Compare :put and p which are always linewise.

lines is readfile() style list of lines.

type is edit behavior: any getregtype() result, or:

"b": blockwise-visual mode (may include width, e.g. "b3")
"c": characterwise mode
"l": linewise mode
"" : guess by contents, see setreg()

after is insert after cursor (like `p`), or before (like `P`).

follow is place cursor at end of inserted text.

func (*Batch) ReplaceTermcodes

func (b *Batch) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool, input *string)

ReplaceTermcodes replaces any terminal code strings by byte sequences.

The returned sequences are Nvim's internal representation of keys, for example:

<esc> -> '\x1b'
<cr>  -> '\r'
<c-l> -> '\x0c'
<up>  -> '\x80ku'

The returned sequences can be used as input to feedkeys.

func (*Batch) Request

func (b *Batch) Request(procedure string, result interface{}, args ...interface{})

Request makes a RPC request atomically as a part of batch request.

func (*Batch) RuntimeFiles added in v1.1.1

func (b *Batch) RuntimeFiles(name string, all bool, files *[]string)

RuntimeFiles finds files in runtime directories and returns list of absolute paths to the found files.

The name arg is can contain wildcards. For example,

RuntimeFiles("colors/*.vim", true)

will return all color scheme files.

The all arg is whether to return all matches or only the first.

func (*Batch) RuntimePaths

func (b *Batch) RuntimePaths(paths *[]string)

RuntimePaths returns a list of paths contained in the runtimepath option.

func (*Batch) SelectPopupmenuItem

func (b *Batch) SelectPopupmenuItem(item int, insert bool, finish bool, opts map[string]interface{})

SelectPopupmenuItem selects an item in the completion popupmenu.

If |ins-completion| is not active this API call is silently ignored. Useful for an external UI using |ui-popupmenu| to control the popupmenu with the mouse. Can also be used in a mapping; use <cmd> |:map-cmd| to ensure the mapping doesn't end completion mode.

The `opts` optional parameters. Reserved for future use.

func (*Batch) SetBufferExtmark added in v1.0.2

func (b *Batch) SetBufferExtmark(buffer Buffer, nsID int, line int, col int, opts map[string]interface{}, id *int)

SetBufferExtmark creates or updates an extmark.

To create a new extmark, pass id=0. The extmark id will be returned. To move an existing mark, pass its id.

It is also allowed to create a new mark by passing in a previously unused id, but the caller must then keep track of existing and unused ids itself. (Useful over RPC, to avoid waiting for the return value.)

Using the optional arguments, it is possible to use this to highlight a range of text, and also to associate virtual text to the mark.

The `opts` is additional options. Supports the string keys are:

id (value: int)

ID of the extmark to edit.

end_line (value: int)

Ending line of the mark, 0-based inclusive.

end_col (value: int)

Ending col of the mark, 0-based inclusive.

hl_group (value: string or int)

Name ar ID of the highlight group used to highlight this mark.

virt_text (value: VirtualTextChunk)

virtual text to link to this mark.

ephemeral (value: bool)

For use with SetDecorationProvider callbacks. The mark will only be used for the current redraw cycle, and not be permantently stored in the buffer.

func (*Batch) SetBufferKeyMap added in v1.0.1

func (b *Batch) SetBufferKeyMap(buffer Buffer, mode string, lhs string, rhs string, opts map[string]bool)

SetBufferKeyMap sets a buffer-local mapping for the given mode.

See:

:help nvim_set_keymap()

func (*Batch) SetBufferLines

func (b *Batch) SetBufferLines(buffer Buffer, start int, end int, strict bool, replacement [][]byte)

SetBufferLines replaces a line range on a buffer.

Indexing is zero-based, end-exclusive. Negative indices are interpreted as length+1+index, ie -1 refers to the index past the end. So to change or delete the last element set start=-2 and end=-1.

To insert lines at a given index, set both start and end to the same index. To delete a range of lines, set replacement to an empty array.

Out-of-bounds indices are clamped to the nearest valid value, unless strict = true.

func (*Batch) SetBufferName

func (b *Batch) SetBufferName(buffer Buffer, name string)

SetBufferName sets the full file name of a buffer. BufFilePre/BufFilePost are triggered.

func (*Batch) SetBufferOption

func (b *Batch) SetBufferOption(buffer Buffer, name string, value interface{})

SetBufferOption sets a buffer option value. The value nil deletes the option in the case where there's a global fallback.

func (*Batch) SetBufferText added in v1.1.6

func (b *Batch) SetBufferText(buffer Buffer, startRow int, startCol int, endRow int, endCol int, replacement [][]byte)

SetBufferText sets or replaces a range in the buffer.

This is recommended over SetBufferLines when only modifying parts of a line, as extmarks will be preserved on non-modified parts of the touched lines.

Indexing is zero-based and end-exclusive.

To insert text at a given index, set `start` and `end` ranges to the same index. To delete a range, set `replacement` to an array containing an empty string, or simply an empty array.

Prefer SetBufferLines when adding or deleting entire lines only.

func (*Batch) SetBufferToWindow

func (b *Batch) SetBufferToWindow(window Window, buffer Buffer)

SetBufferToWindow sets the current buffer in a window, without side-effects.

func (*Batch) SetBufferVar

func (b *Batch) SetBufferVar(buffer Buffer, name string, value interface{})

SetBufferVar sets a buffer-scoped (b:) variable.

func (*Batch) SetBufferVirtualText

func (b *Batch) SetBufferVirtualText(buffer Buffer, nsID int, line int, chunks []VirtualTextChunk, opts map[string]interface{}, id *int)

SetBufferVirtualText sets the virtual text (annotation) for a buffer line.

By default (and currently the only option) the text will be placed after the buffer text. Virtual text will never cause reflow, rather virtual text will be truncated at the end of the screen line. The virtual text will begin one cell (|lcs-eol| or space) after the ordinary text.

Namespaces are used to support batch deletion/updating of virtual text. To create a namespace, use CreateNamespace(). Virtual text is cleared using ClearBufferNamespace(). The same `nsID` can be used for both virtual text and highlights added by AddBufferHighlight(), both can then be cleared with a single call to ClearBufferNamespace(). If the virtual text never will be cleared by an API call, pass `nsID = -1`.

As a shorthand, `nsID = 0` can be used to create a new namespace for the virtual text, the allocated id is then returned.

The `opts` is optional parameters. Currently not used.

The returns the nsID that was used.

func (*Batch) SetClientInfo

func (b *Batch) SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes)

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 (*Batch) SetCurrentBuffer

func (b *Batch) SetCurrentBuffer(buffer Buffer)

SetCurrentBuffer sets the current buffer.

func (*Batch) SetCurrentDirectory

func (b *Batch) SetCurrentDirectory(dir string)

SetCurrentDirectory changes the Vim working directory.

func (*Batch) SetCurrentLine

func (b *Batch) SetCurrentLine(line []byte)

SetCurrentLine sets the current line in the current buffer.

func (*Batch) SetCurrentTabpage

func (b *Batch) SetCurrentTabpage(tabpage Tabpage)

SetCurrentTabpage sets the current tabpage.

func (*Batch) SetCurrentWindow

func (b *Batch) SetCurrentWindow(window Window)

SetCurrentWindow sets the current window.

func (*Batch) SetHighlight added in v1.1.4

func (b *Batch) SetHighlight(nsID int, name string, val *HLAttrs)

SetHighlight set a highlight group.

name arg is highlight group name, like ErrorMsg.

val arg is highlight definiton map, like HLByName.

func (*Batch) SetHighlightNameSpace added in v1.1.4

func (b *Batch) SetHighlightNameSpace(nsID int)

SetHighlightNameSpace set active namespace for highlights.

NB: this function can be called from async contexts, but the semantics are not yet well-defined. To start with SetDecorationProvider on_win and on_line callbacks are explicitly allowed to change the namespace during a redraw cycle.

The `nsID` arg is the namespace to activate.

func (*Batch) SetKeyMap added in v1.0.1

func (b *Batch) SetKeyMap(mode string, lhs string, rhs string, opts map[string]bool)

SetKeyMap sets a global mapping for the given mode.

To set a buffer-local mapping, use SetBufferKeyMap().

Unlike :map, leading/trailing whitespace is accepted as part of the {lhs} or {rhs}. Empty {rhs} is <Nop>. keycodes are replaced as usual.

mode

mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for :map!, or empty string for :map.

lhs

Left-hand-side {lhs} of the mapping.

rhs

Right-hand-side {rhs} of the mapping.

opts

Optional parameters map. Accepts all :map-arguments as keys excluding <buffer> but including noremap. Values are Booleans. Unknown key is an error.

func (*Batch) SetOption

func (b *Batch) SetOption(name string, value interface{})

SetOption sets an option.

func (*Batch) SetPumBounds added in v1.1.4

func (b *Batch) SetPumBounds(width float64, height float64, row float64, col float64)

SetPumBounds tells Nvim the geometry of the popumenu, to align floating windows with an external popup menu.

Note that this method is not to be confused with SetPumHeight, which sets the number of visible items in the popup menu, while this function sets the bounding box of the popup menu, including visual elements such as borders and sliders.

Floats need not use the same font size, nor be anchored to exact grid corners, so one can set floating-point numbers to the popup menu geometry.

func (*Batch) SetPumHeight added in v1.0.2

func (b *Batch) SetPumHeight(height int)

SetPumHeight tells Nvim the number of elements displaying in the popumenu, to decide <PageUp> and <PageDown> movement.

height is popupmenu height, must be greater than zero.

func (*Batch) SetTabpageVar

func (b *Batch) SetTabpageVar(tabpage Tabpage, name string, value interface{})

SetTabpageVar sets a tab-scoped (t:) variable.

func (*Batch) SetUIOption

func (b *Batch) SetUIOption(name string, value interface{})

SetUIOption sets a UI option.

func (*Batch) SetVVar

func (b *Batch) SetVVar(name string, value interface{})

SetVVar sets a v: variable, if it is not readonly.

func (*Batch) SetVar

func (b *Batch) SetVar(name string, value interface{})

SetVar sets a global (g:) variable.

func (*Batch) SetWindowConfig

func (b *Batch) SetWindowConfig(window Window, config *WindowConfig)

SetWindowConfig configure window position. Currently this is only used to configure floating and external windows (including changing a split window to these types).

See documentation at OpenWindow, for the meaning of parameters.

When reconfiguring a floating window, absent option keys will not be changed. The following restriction are apply must be reconfigured together. Only changing a subset of these is an error.

row
col
relative

func (*Batch) SetWindowCursor

func (b *Batch) SetWindowCursor(window Window, pos [2]int)

SetWindowCursor sets the cursor position in the window to the given position.

func (*Batch) SetWindowHeight

func (b *Batch) SetWindowHeight(window Window, height int)

SetWindowHeight sets the window height.

func (*Batch) SetWindowOption

func (b *Batch) SetWindowOption(window Window, name string, value interface{})

SetWindowOption sets a window option.

func (*Batch) SetWindowVar

func (b *Batch) SetWindowVar(window Window, name string, value interface{})

SetWindowVar sets a window-scoped (w:) variable.

func (*Batch) SetWindowWidth

func (b *Batch) SetWindowWidth(window Window, width int)

SetWindowWidth sets the window width.

func (*Batch) StringWidth

func (b *Batch) StringWidth(s string, width *int)

StringWidth returns the number of display cells the string occupies. Tab is counted as one cell.

func (*Batch) Subscribe

func (b *Batch) Subscribe(event string)

Subscribe subscribes to a Nvim event.

func (*Batch) TabpageNumber

func (b *Batch) TabpageNumber(tabpage Tabpage, number *int)

TabpageNumber gets the tabpage number from the tabpage handle.

func (*Batch) TabpageVar

func (b *Batch) TabpageVar(tabpage Tabpage, name string, result interface{})

TabpageVar gets a tab-scoped (t:) variable.

func (*Batch) TabpageWindow

func (b *Batch) TabpageWindow(tabpage Tabpage, result *Window)

TabpageWindow gets the current window in a tab page.

func (*Batch) TabpageWindows

func (b *Batch) TabpageWindows(tabpage Tabpage, windows *[]Window)

TabpageWindows returns the windows in a tabpage.

func (*Batch) Tabpages

func (b *Batch) Tabpages(tabpages *[]Tabpage)

Tabpages returns the current list of tabpages.

func (*Batch) TryResizeUI

func (b *Batch) TryResizeUI(width int, height int)

TryResizeUI notifies Nvim that the client window has resized. If possible, Nvim will send a redraw request to resize.

func (*Batch) TryResizeUIGrid

func (b *Batch) TryResizeUIGrid(grid int, width int, height int)

TryResizeUIGrid tell Nvim to resize a grid. Triggers a grid_resize event with the requested grid size or the maximum size if it exceeds size limits.

On invalid grid handle, fails with error.

func (*Batch) UIs

func (b *Batch) UIs(uis *[]*UI)

UIs gets a list of dictionaries representing attached UIs.

func (*Batch) Unsubscribe

func (b *Batch) Unsubscribe(event string)

Unsubscribe unsubscribes to a Nvim event.

func (*Batch) VVar

func (b *Batch) VVar(name string, result interface{})

VVar gets a vim (v:) variable.

func (*Batch) Var

func (b *Batch) Var(name string, result interface{})

Var gets a global (g:) variable.

func (*Batch) WindowBuffer

func (b *Batch) WindowBuffer(window Window, buffer *Buffer)

WindowBuffer returns the current buffer in a window.

func (*Batch) WindowConfig

func (b *Batch) WindowConfig(window Window, config *WindowConfig)

WindowConfig return window configuration.

Return a dictionary containing the same config that can be given to OpenWindow.

The `relative` will be an empty string for normal windows.

func (*Batch) WindowCursor

func (b *Batch) WindowCursor(window Window, pos *[2]int)

WindowCursor returns the cursor position in the window.

func (*Batch) WindowHeight

func (b *Batch) WindowHeight(window Window, height *int)

WindowHeight returns the window height.

func (*Batch) WindowNumber

func (b *Batch) WindowNumber(window Window, number *int)

WindowNumber gets the window number from the window handle.

func (*Batch) WindowOption

func (b *Batch) WindowOption(window Window, name string, result interface{})

WindowOption gets a window option.

func (*Batch) WindowPosition

func (b *Batch) WindowPosition(window Window, pos *[2]int)

WindowPosition gets the window position in display cells. First position is zero.

func (*Batch) WindowTabpage

func (b *Batch) WindowTabpage(window Window, tabpage *Tabpage)

WindowTabpage gets the tab page that contains the window.

func (*Batch) WindowVar

func (b *Batch) WindowVar(window Window, name string, result interface{})

WindowVar gets a window-scoped (w:) variable.

func (*Batch) WindowWidth

func (b *Batch) WindowWidth(window Window, width *int)

WindowWidth returns the window width.

func (*Batch) Windows

func (b *Batch) Windows(windows *[]Window)

Windows returns the current list of windows.

func (*Batch) WriteErr

func (b *Batch) WriteErr(str string)

WriteErr writes a message to vim error buffer. The string is split and flushed after each newline. Incomplete lines are kept for writing later.

func (*Batch) WriteOut

func (b *Batch) WriteOut(str string)

WriteOut writes a message to vim output buffer. The string is split and flushed after each newline. Incomplete lines are kept for writing later.

func (*Batch) WritelnErr

func (b *Batch) WritelnErr(str string)

WritelnErr writes prints str and a newline as an error message.

type BatchError

type BatchError struct {
	// Index is a zero-based index of the function call which resulted in the
	// error.
	Index int

	// Err is the error.
	Err error
}

BatchError represents an error from a API function call in a Batch.

func (*BatchError) Error

func (e *BatchError) Error() string

Error implements the error interface.

type Buffer

type Buffer int

Buffer represents a Nvim buffer.

func (Buffer) MarshalMsgPack

func (x Buffer) MarshalMsgPack(enc *msgpack.Encoder) error

MarshalMsgPack implements msgpack.Marshaler.

func (Buffer) String

func (x Buffer) String() string

String returns a string representation of the Buffer.

func (*Buffer) UnmarshalMsgPack

func (x *Buffer) UnmarshalMsgPack(dec *msgpack.Decoder) error

UnmarshalMsgPack implements msgpack.Unmarshaler.

type 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.
	Pty string `msgpack:"pty,omitempty"`

	// Buffer is the buffer with connected terminal instance.
	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 SetClientInfo.
	Client *Client `msgpack:"client,omitempty"`
}

Channel information about a channel.

type ChildProcessOption

type ChildProcessOption struct {
	// contains filtered or unexported fields
}

ChildProcessOption specifies an option for creating a child process.

func ChildProcessArgs

func ChildProcessArgs(args ...string) ChildProcessOption

ChildProcessArgs specifies the command line arguments. The application must include the --embed flag or other flags that cause Nvim to use stdin/stdout as a MsgPack RPC channel.

func ChildProcessCommand

func ChildProcessCommand(command string) ChildProcessOption

ChildProcessCommand specifies the command to run. NewChildProcess runs "nvim" by default.

func ChildProcessContext

func ChildProcessContext(ctx context.Context) ChildProcessOption

ChildProcessContext specifies the context to use when starting the command. The background context is used by defaullt.

func ChildProcessDir

func ChildProcessDir(dir string) ChildProcessOption

ChildProcessDir specifies the working directory for the process. The current working directory is used by default.

func ChildProcessEnv

func ChildProcessEnv(env []string) ChildProcessOption

ChildProcessEnv specifies the environment for the child process. The current process environment is used by default.

func ChildProcessLogf

func ChildProcessLogf(logf func(string, ...interface{})) ChildProcessOption

ChildProcessLogf specifies function for logging output. The log.Printf function is used by default.

func ChildProcessServe

func ChildProcessServe(serve bool) ChildProcessOption

ChildProcessServe specifies whether Server should be run in a goroutine. The default is to run Serve().

type Client

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"`
}

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 ClientAttributes

type ClientAttributes map[string]string

ClientAttributes informal attributes describing the client. Clients might define their own keys, but the following are suggested.

type ClientMethod

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
}

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 ClientMethodNArgs

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
}

ClientMethodNArgs is the number of arguments. Could be a single integer or an array two integers, minimum and maximum inclusive.

type ClientType

type ClientType string

ClientType type of client information.

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"
)

type ClientVersion

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"`
}

ClientVersion represents a version of client for nvim.

type Command

type Command struct {
	// Name is the name of command.
	Name string `msgpack:"name"`

	// Nargs is the command-nargs.
	// See :help :command-nargs.
	Nargs string `msgpack:"nargs"`

	// Complete is the specifying one or the other of the following attributes.
	// See :help :command-completion.
	Complete string `msgpack:"complete,omitempty"`

	// CompleteArg is the argument completion name.
	CompleteArg string `msgpack:"complete_arg,omitempty"`

	// Range is the specify that the command does take a range, or that it takes an arbitrary count value.
	Range string `msgpack:"range,omitempty"`

	// Count is a count (default N) which is specified either in the line number position, or as an initial argument, like `:Next`.
	// Specifying -count (without a default) acts like -count=0
	Count string `msgpack:"count,omitempty"`

	// Addr is the special characters in the range like `.`, `$` or `%` which by default correspond to the current line,
	// last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages.
	Addr string `msgpack:"addr,omitempty"`

	// Bang is the command can take a ! modifier, like `:q` or `:w`.
	Bang bool `msgpack:"bang"`

	// Bar is the command can be followed by a `|` and another command.
	// A `|` inside the command argument is not allowed then. Also checks for a `"` to start a comment.
	Bar bool `msgpack:"bar"`

	// Register is the first argument to the command can be an optional register name, like `:del`, `:put`, `:yank`.
	Register bool `msgpack:"register"`

	// ScriptID is the line number in the script sid.
	ScriptID int `msgpack:"script_id"`

	// Definition is the command's replacement string.
	Definition string `msgpack:"definition"`
}

Command represents a Neovim Ex command.

type CommandCompletionArgs

type CommandCompletionArgs struct {
	// ArgLead is the leading portion of the argument currently being completed
	// on.
	ArgLead string `msgpack:",array"`

	// CmdLine is the entire command line.
	CmdLine string

	// CursorPosString is decimal representation of the cursor position in
	// bytes.
	CursorPosString int
}

CommandCompletionArgs represents the arguments to a custom command line completion function.

:help :command-completion-custom

func (*CommandCompletionArgs) CursorPos

func (a *CommandCompletionArgs) CursorPos() int

CursorPos returns the cursor position.

type DialOption

type DialOption struct {
	// contains filtered or unexported fields
}

DialOption specifies an option for dialing to Nvim.

func DialContext

func DialContext(ctx context.Context) DialOption

DialContext specifies the context to use when starting the command. The background context is used by default.

func DialLogf

func DialLogf(logf func(string, ...interface{})) DialOption

DialLogf specifies function for logging output. The log.Printf function is used by default.

func DialNetDial

func DialNetDial(f func(ctx context.Context, network, address string) (net.Conn, error)) DialOption

DialNetDial specifies a function used to dial a network connection. A default net.Dialer DialContext method is used by default.

func DialServe

func DialServe(serve bool) DialOption

DialServe specifies whether Server should be run in a goroutine. The default is to run Serve().

type EchoChunk added in v1.1.6

type EchoChunk struct {
	// Text is echo text.
	Text string `msgpack:",array"`

	// HLGroup is echo highlight group.
	HLGroup string
}

EchoChunk represents a echo chunk.

type EmbedOptions deprecated

type EmbedOptions struct {
	// Args specifies the command line arguments. Do not include the program
	// name (the first argument) or the --embed option.
	Args []string

	// Dir specifies the working directory of the command. The working
	// directory in the current process is used if Dir is "".
	Dir string

	// Env specifies the environment of the Nvim process. The current process
	// environment is used if Env is nil.
	Env []string

	// Path is the path of the command to run. If Path = "", then
	// StartEmbeddedNvim searches for "nvim" on $PATH.
	Path string

	Logf func(string, ...interface{})
}

EmbedOptions specifies options for starting an embedded instance of Nvim.

Deprecated: Use ChildProcessOption instead.

type ErrorList

type ErrorList []error

ErrorList is a list of errors.

func (ErrorList) Error

func (el ErrorList) Error() string

Error implements the error interface.

type ExtMarks added in v1.0.2

type ExtMarks struct {
	// ID is the extmarks ID.
	ID int `msgpack:",array"`

	// Row is the extmark row position.
	Row int

	// Col is the extmark column position.
	Col int
}

ExtMarks represents a extmarks type.

type HLAttrs

type HLAttrs struct {
	// Bold is the bold font style.
	Bold bool `msgpack:"bold,omitempty"`

	// Underline is the underline font style.
	Underline bool `msgpack:"underline,omitempty"`

	// Undercurl is the curly underline font style.
	Undercurl bool `msgpack:"undercurl,omitempty"`

	// Italic is the italic font style.
	Italic bool `msgpack:"italic,omitempty"`

	// Reverse is the reverse to foreground and background.
	Reverse bool `msgpack:"reverse,omitempty"`

	// Inverse same as Reverse.
	Inverse bool `msgpack:"inverse,omitempty"`

	// Standout is the standout font style.
	Standout int `msgpack:"standout,omitempty"`

	// Nocombine override attributes instead of combining them.
	Nocombine int `msgpack:"nocombine,omitempty"`

	// Foreground use normal foreground color.
	Foreground int `msgpack:"foreground,omitempty" empty:"-1"`

	// Background use normal background color.
	Background int `msgpack:"background,omitempty" empty:"-1"`

	// Special is used for undercurl and underline.
	Special int `msgpack:"special,omitempty" empty:"-1"`

	// Blend override the blend level for a highlight group within the popupmenu
	// or floating windows.
	//
	// Only takes effect if 'pumblend' or 'winblend' is set for the menu or window.
	// See the help at the respective option.
	Blend int `msgpack:"blend,omitempty"`
}

HLAttrs represents a highlight definitions.

type Mapping

type Mapping struct {
	// LHS is the {lhs} of the mapping.
	LHS string `msgpack:"lhs,omitempty"`

	// RHS is the {hrs} of the mapping as typed.
	RHS string `msgpack:"rhs,omitempty"`

	// Silent is 1 for a :map-silent mapping, else 0.
	Silent int `msgpack:"silent,omitempty"`

	// Noremap is 1 if the {rhs} of the mapping is not remappable.
	NoRemap int `msgpack:"noremap,omitempty"`

	// Expr is  1 for an expression mapping.
	Expr int `msgpack:"expr,omitempty"`

	// Buffer for a local mapping.
	Buffer int `msgpack:"buffer,omitempty"`

	// SID is the script local ID, used for <sid> mappings.
	SID int `msgpack:"sid,omitempty"`

	// Nowait is 1 if map does not wait for other, longer mappings.
	NoWait int `msgpack:"nowait,omitempty"`

	// Mode specifies modes for which the mapping is defined.
	Mode string `msgpack:"string,omitempty"`
}

Mapping represents a nvim mapping options.

type 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"`
}

Mode represents a Nvim's current mode.

type Nvim

type Nvim struct {
	// contains filtered or unexported fields
}

Nvim represents a remote instance of Nvim. It is safe to call Nvim methods concurrently.

func Dial

func Dial(address string, options ...DialOption) (*Nvim, error)

Dial dials an Nvim instance given an address in the format used by $NVIM_LISTEN_ADDRESS.

:help rpc-connecting
:help $NVIM_LISTEN_ADDRESS

func New

func New(r io.Reader, w io.Writer, c io.Closer, logf func(string, ...interface{})) (*Nvim, error)

New creates an Nvim client. When connecting to Nvim over stdio, use stdin as r and stdout as w and c, When connecting to Nvim over a network connection, use the connection for r, w and c.

The application must call Serve() to handle RPC requests and responses.

New is a low-level function. Most applications should use NewChildProcess, Dial or the ./plugin package.

:help rpc-connecting

func NewChildProcess

func NewChildProcess(options ...ChildProcessOption) (*Nvim, error)

NewChildProcess returns a client connected to stdin and stdout of a new child process.

func NewEmbedded deprecated

func NewEmbedded(options *EmbedOptions) (*Nvim, error)

NewEmbedded starts an embedded instance of Nvim using the specified options.

The application must call Serve() to handle RPC requests and responses.

Deprecated: Use NewChildProcess instead.

func (*Nvim) APIInfo

func (v *Nvim) APIInfo() (apiInfo []interface{}, err error)

func (*Nvim) AddBufferHighlight

func (v *Nvim) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int) (id int, err error)

AddBufferHighlight adds a highlight to buffer and returns the source id of the highlight.

AddBufferHighlight can be used for plugins which dynamically generate highlights to a buffer (like a semantic highlighter or linter). The function adds a single highlight to a buffer. Unlike matchaddpos() highlights follow changes to line numbering (as lines are inserted/removed above the highlighted line), like signs and marks do.

The srcID is useful for batch deletion/updating of a set of highlights. When called with srcID = 0, an unique source id is generated and returned. Successive calls can pass in it as srcID to add new highlights to the same source group. All highlights in the same group can then be cleared with ClearBufferHighlight. If the highlight never will be manually deleted pass in -1 for srcID.

If hlGroup is the empty string no highlight is added, but a new srcID is still returned. This is useful for an external plugin to synchronously request an unique srcID at initialization, and later asynchronously add and clear highlights in response to buffer changes.

The startCol and endCol parameters specify the range of columns to highlight. Use endCol = -1 to highlight to the end of the line.

func (*Nvim) AllOptionsInfo added in v1.1.4

func (v *Nvim) AllOptionsInfo() (opinfo *OptionInfo, err error)

AllOptionsInfo gets the option information for all options.

The dictionary has the full option names as keys and option metadata dictionaries as detailed at OptionInfo.

Resulting map has keys:

name

Name of the option (like 'filetype').

shortname

Shortened name of the option (like 'ft').

type

type of option ("string", "number" or "boolean").

default

The default value for the option.

was_set

Whether the option was set.

last_set_sid

Last set script id (if any).

last_set_linenr

line number where option was set.

last_set_chan

Channel where option was set (0 for local).

scope

one of "global", "win", or "buf".

global_local

whether win or buf option has a global value.

commalist

List of comma separated values.

flaglist

List of single char flags.

func (*Nvim) AttachBuffer

func (v *Nvim) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}) (attached bool, err error)

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 (*Nvim) AttachUI

func (v *Nvim) AttachUI(width int, height int, options map[string]interface{}) error

AttachUI registers the client as a remote UI. After this method is called, the client will receive redraw notifications.

:help rpc-remote-ui

The redraw notification method has variadic arguments. Register a handler for the method like this:

v.RegisterHandler("redraw", func(updates ...[]interface{}) {
    for _, update := range updates {
        // handle update
    }
})

func (*Nvim) BufferChangedTick

func (v *Nvim) BufferChangedTick(buffer Buffer) (changedtick int, err error)

BufferChangedTick gets a changed tick of a buffer.

func (*Nvim) BufferCommands

func (v *Nvim) BufferCommands(buffer Buffer, opts map[string]interface{}) (map[string]*Command, error)

BufferCommands gets a map of buffer-local user-commands.

opts is optional parameters. Currently not used.

func (*Nvim) BufferExtmarkByID added in v1.0.2

func (v *Nvim) BufferExtmarkByID(buffer Buffer, nsID int, id int, opt map[string]interface{}) (pos []int, err error)

BufferExtmarkByID returns position for a given extmark id.

The `opts` is additional options. Supports the string keys are:

limit (value: int)

Maximum number of marks to return.

details (value: bool)

Whether to include the details dict.

func (*Nvim) BufferExtmarks added in v1.0.2

func (v *Nvim) BufferExtmarks(buffer Buffer, nsID int, start interface{}, end interface{}, opt map[string]interface{}) (marks []ExtMarks, err error)

BufferExtmarks gets extmarks in "traversal order" from a charwise region defined by buffer positions (inclusive, 0-indexed).

Region can be given as (row,col) tuples, or valid extmark ids (whose positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1) respectively, thus the following are equivalent:

BufferExtmarks(0, myNS, 0, -1, {})
BufferExtmarks(0, myNS, [0,0], [-1,-1], {})

If `end` is less than `start`, traversal works backwards. (Useful with `limit`, to get the first marks prior to a given position.)

The `opts` is additional options. Supports the string keys are:

limit (value: int)

Maximum number of marks to return.

details (value: bool)

Whether to include the details dict.

func (*Nvim) BufferKeyMap

func (v *Nvim) BufferKeyMap(buffer Buffer, mode string) ([]*Mapping, error)

BufferKeymap gets a list of buffer-local mappings.

The mode short-name ("n", "i", "v", ...).

func (*Nvim) BufferLineCount

func (v *Nvim) BufferLineCount(buffer Buffer) (count int, err error)

BufferLineCount returns the number of lines in the buffer.

func (*Nvim) BufferLines

func (v *Nvim) BufferLines(buffer Buffer, start int, end int, strict bool) (lines [][]byte, err error)

BufferLines retrieves a line range from a buffer.

Indexing is zero-based, end-exclusive. Negative indices are interpreted as length+1+index, i e -1 refers to the index past the end. So to get the last element set start=-2 and end=-1.

Out-of-bounds indices are clamped to the nearest valid value, unless strict = true.

func (*Nvim) BufferMark

func (v *Nvim) BufferMark(buffer Buffer, name string) (pos [2]int, err error)

BufferMark returns the (row,col) of the named mark.

func (*Nvim) BufferName

func (v *Nvim) BufferName(buffer Buffer) (name string, err error)

BufferName gets the full file name of a buffer.

func (*Nvim) BufferNumber deprecated

func (v *Nvim) BufferNumber(buffer Buffer) (number int, err error)

BufferNumber gets a buffer's number.

Deprecated: Use int(buffer) to get the buffer's number as an integer.

func (*Nvim) BufferOffset

func (v *Nvim) BufferOffset(buffer Buffer, index int) (offset int, err error)

BufferOffset returns the byte offset for a line.

Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte. 'fileformat' and 'fileencoding' are ignored. The line index just after the last line gives the total byte-count of the buffer. A final EOL byte is counted if it would be written, see 'eol'.

Unlike |line2byte()|, throws error for out-of-bounds indexing. Returns -1 for unloaded buffer.

func (*Nvim) BufferOption

func (v *Nvim) BufferOption(buffer Buffer, name string, result interface{}) error

BufferOption gets a buffer option value.

func (*Nvim) BufferVar

func (v *Nvim) BufferVar(buffer Buffer, name string, result interface{}) error

BufferVar gets a buffer-scoped (b:) variable.

func (*Nvim) Buffers

func (v *Nvim) Buffers() (buffers []Buffer, err error)

Buffers returns the current list of buffers.

func (*Nvim) Call

func (v *Nvim) Call(fname string, result interface{}, args ...interface{}) error

Call calls a vimscript function.

func (*Nvim) CallDict

func (v *Nvim) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{}) error

CallDict calls a vimscript Dictionary function.

func (*Nvim) ChannelID

func (v *Nvim) ChannelID() int

ChannelID returns Nvim's channel id for this client.

func (*Nvim) ChannelInfo

func (v *Nvim) ChannelInfo(channelID int) (channel *Channel, err error)

ChannelInfo get information about a channel.

func (*Nvim) Channels

func (v *Nvim) Channels() (channels []*Channel, err error)

Channels get information about all open channels.

func (*Nvim) ClearBufferHighlight deprecated

func (v *Nvim) ClearBufferHighlight(buffer Buffer, srcID int, startLine int, endLine int) error

ClearBufferHighlight clears highlights from a given source group and a range of lines.

To clear a source group in the entire buffer, pass in 1 and -1 to startLine and endLine respectively.

The lineStart and lineEnd parameters specify the range of lines to clear. The end of range is exclusive. Specify -1 to clear to the end of the file.

Deprecated: Use ClearBufferNamespace() instead.

func (*Nvim) ClearBufferNamespace

func (v *Nvim) ClearBufferNamespace(buffer Buffer, nsID int, lineStart int, lineEnd int) error

ClearBufferNamespace clears namespaced objects, highlights and virtual text, from a line range.

To clear the namespace in the entire buffer, pass in 0 and -1 to line_start and line_end respectively.

func (*Nvim) Close

func (v *Nvim) Close() error

Close releases the resources used the client.

func (*Nvim) CloseWindow

func (v *Nvim) CloseWindow(window Window, force bool) error

CloseWindow close a window.

This is equivalent to |:close| with count except that it takes a window id.

func (*Nvim) ColorByName

func (v *Nvim) ColorByName(name string) (color int, err error)

ColorByName returns the 24-bit RGB value of a ColorMap color name or `#rrggbb` hexadecimal string.

func (*Nvim) ColorMap

func (v *Nvim) ColorMap() (colorMap map[string]int, err error)

ColorMap returns a map of color names and RGB values.

Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values (e.g. 65535).

The returns map is color names and RGB values.

func (*Nvim) Command

func (v *Nvim) Command(cmd string) error

Command executes a single ex command.

func (*Nvim) CommandOutput deprecated

func (v *Nvim) CommandOutput(cmd string) (out string, err error)

CommandOutput executes a single ex command and returns the output.

Deprecated: Use Exec() instead.

func (*Nvim) Commands

func (v *Nvim) Commands(opts map[string]interface{}) (commands map[string]*Command, err error)

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 (*Nvim) Context added in v1.0.2

func (v *Nvim) Context(opts map[string][]string) (contexts map[string]interface{}, err error)

Context gets a map of the current editor state. This API still under development.

The `opts` is optional parameters.

types

List of context-types to gather, or empty for all context.

regs
jumps
bufs
gvars
funcs
sfuncs

func (*Nvim) CreateBuffer

func (v *Nvim) CreateBuffer(listed bool, scratch bool) (buffer Buffer, err error)

CreateBuffer creates a new, empty, unnamed buffer.

func (*Nvim) CreateNamespace

func (v *Nvim) CreateNamespace(name string) (nsID int, err error)

CreateNamespace creates a new namespace, or gets an existing one.

Namespaces are used for buffer highlights and virtual text, see AddBufferHighlight() and SetBufferVirtualText().

Namespaces can be named or anonymous. If `name` matches an existing namespace, the associated id is returned. If `name` is an empty string a new, anonymous namespace is created.

The returns the namespace ID.

func (*Nvim) CurrentBuffer

func (v *Nvim) CurrentBuffer() (buffer Buffer, err error)

CurrentBuffer returns the current buffer.

func (*Nvim) CurrentLine

func (v *Nvim) CurrentLine() (line []byte, err error)

CurrentLine gets the current line in the current buffer.

func (*Nvim) CurrentTabpage

func (v *Nvim) CurrentTabpage() (tabpage Tabpage, err error)

CurrentTabpage returns the current tabpage.

func (*Nvim) CurrentWindow

func (v *Nvim) CurrentWindow() (window Window, err error)

CurrentWindow returns the current window.

func (*Nvim) DeleteBuffer added in v1.1.4

func (v *Nvim) DeleteBuffer(buffer Buffer, opts map[string]bool) error

DeleteBuffer deletes the buffer.

See:

:help bwipeout

The `opts` is additional options. Supports the key:

force

Force deletion and ignore unsaved changes.

unload

Unloaded only, do not delete. See :help bunload.

func (*Nvim) DeleteBufferExtmark added in v1.0.2

func (v *Nvim) DeleteBufferExtmark(buffer Buffer, nsID int, extmarkID int) (deleted bool, err error)

DeleteBufferExtmark removes an extmark.

func (*Nvim) DeleteBufferKeyMap added in v1.0.1

func (v *Nvim) DeleteBufferKeyMap(buffer Buffer, mode string, lhs string) error

DeleteBufferKeyMap unmaps a buffer-local mapping for the given mode.

See:

:help nvim_del_keymap()

func (*Nvim) DeleteBufferVar

func (v *Nvim) DeleteBufferVar(buffer Buffer, name string) error

DeleteBufferVar removes a buffer-scoped (b:) variable.

func (*Nvim) DeleteCurrentLine

func (v *Nvim) DeleteCurrentLine() error

DeleteCurrentLine deletes the current line in the current buffer.

func (*Nvim) DeleteKeyMap added in v1.0.1

func (v *Nvim) DeleteKeyMap(mode string, lhs string) error

DeleteKeyMap unmaps a global mapping for the given mode.

To unmap a buffer-local mapping, use DeleteBufferKeyMap().

See:

:help nvim_set_keymap()

func (*Nvim) DeleteTabpageVar

func (v *Nvim) DeleteTabpageVar(tabpage Tabpage, name string) error

DeleteTabpageVar removes a tab-scoped (t:) variable.

func (*Nvim) DeleteVar

func (v *Nvim) DeleteVar(name string) error

DeleteVar removes a global (g:) variable.

func (*Nvim) DeleteWindowVar

func (v *Nvim) DeleteWindowVar(window Window, name string) error

DeleteWindowVar removes a window-scoped (w:) variable.

func (*Nvim) DetachBuffer

func (v *Nvim) DetachBuffer(buffer Buffer) (detached bool, err error)

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 (*Nvim) DetachUI

func (v *Nvim) DetachUI() error

DetachUI unregisters the client as a remote UI.

func (*Nvim) Echo added in v1.1.6

func (v *Nvim) Echo(chunks []EchoChunk, history bool, opts map[string]interface{}) error

Echo echo a message.

The chunks is a list of [text, hl_group] arrays, each representing a text chunk with specified highlight. hl_group element can be omitted for no highlight.

If history is true, add to |message-history|.

The opts arg is optional parameters. Reserved for future use.

func (*Nvim) Eval

func (v *Nvim) Eval(expr string, result interface{}) error

Eval evaluates the expression expr using the Vim internal expression evaluator.

:help expression

func (*Nvim) Exec added in v1.0.2

func (v *Nvim) Exec(src string, output bool) (out string, err error)

Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.

func (*Nvim) ExecLua added in v1.0.2

func (v *Nvim) ExecLua(code string, result interface{}, args ...interface{}) error

ExecLua executes a Lua block.

func (*Nvim) ExecuteLua deprecated

func (v *Nvim) ExecuteLua(code string, result interface{}, args ...interface{}) error

ExecuteLua executes a Lua block.

Deprecated: Use ExecLua() instead.

func (*Nvim) FeedKeys

func (v *Nvim) FeedKeys(keys string, mode string, escapeCSI bool) error

FeedKeys Pushes keys to the Nvim user input buffer. Options can be a string with the following character flags:

m

Remap keys. This is default.

n

Do not remap keys.

t

Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, opening folds, etc.

func (*Nvim) HLByID

func (v *Nvim) HLByID(id int, rgb bool) (highlight *HLAttrs, err error)

HLByID gets a highlight definition by id.

func (*Nvim) HLByName

func (v *Nvim) HLByName(name string, rgb bool) (highlight *HLAttrs, err error)

HLByName gets a highlight definition by name.

func (*Nvim) HLIDByName added in v1.0.2

func (v *Nvim) HLIDByName(name string) (highlightID int, err error)

HLIDByName gets a highlight group by name.

func (*Nvim) Input

func (v *Nvim) Input(keys string) (written int, err error)

Input pushes bytes to the Nvim low level input buffer.

Unlike FeedKeys, this uses the lowest level input buffer and the call is not deferred. It returns the number of bytes actually written(which can be less than what was requested if the buffer is full).

func (*Nvim) InputMouse

func (v *Nvim) InputMouse(button string, action string, modifier string, grid int, row int, col int) error

InputMouse send mouse event from GUI.

The call is non-blocking. It doesn't wait on any resulting action, but queues the event to be processed soon by the event loop.

func (*Nvim) IsBufferLoaded

func (v *Nvim) IsBufferLoaded(buffer Buffer) (loaded bool, err error)

IsBufferLoaded Checks if a buffer is valid and loaded. See api-buffer for more info about unloaded buffers.

func (*Nvim) IsBufferValid

func (v *Nvim) IsBufferValid(buffer Buffer) (valied bool, err error)

IsBufferValid returns true if the buffer is valid.

func (*Nvim) IsTabpageValid

func (v *Nvim) IsTabpageValid(tabpage Tabpage) (valid bool, err error)

IsTabpageValid checks if a tab page is valid.

func (*Nvim) IsWindowValid

func (v *Nvim) IsWindowValid(window Window) (valid bool, err error)

IsWindowValid returns true if the window is valid.

func (*Nvim) KeyMap

func (v *Nvim) KeyMap(mode string) (maps []*Mapping, err error)

KeyMap gets a list of global (non-buffer-local) mapping definitions.

The mode arg is the mode short-name, like `n`, `i`, `v` or etc.

func (*Nvim) LoadContext added in v1.0.2

func (v *Nvim) LoadContext(dict map[string]interface{}, result interface{}) error

LoadContext sets the current editor state from the given context map.

func (*Nvim) Mode

func (v *Nvim) Mode() (mode *Mode, err error)

Mode gets Nvim's current mode.

func (*Nvim) Namespaces

func (v *Nvim) Namespaces() (namespaces map[string]int, err error)

Namespaces gets existing named namespaces.

The return dict that maps from names to namespace ids.

func (*Nvim) NewBatch

func (v *Nvim) NewBatch() *Batch

NewBatch creates a new batch.

func (*Nvim) OpenWindow

func (v *Nvim) OpenWindow(buffer Buffer, enter bool, config *WindowConfig) (window Window, err error)

OpenWindow opens a new window.

Currently this is used to open floating and external windows. Floats are windows that are drawn above the split layout, at some anchor position in some other window. Floats can be drawn internally or by external GUI with the |ui-multigrid| extension. External windows are only supported with multigrid GUIs, and are displayed as separate top-level windows.

For a general overview of floats, see |api-floatwin|.

Exactly one of External and Relative must be specified. The Width and Height of the new window must be specified.

With relative=editor (row=0,col=0) refers to the top-left corner of the screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right corner. Fractional values are allowed, but the builtin implementation (used by non-multigrid UIs) will always round down to nearest integer.

Out-of-bounds values, and configurations that make the float not fit inside the main editor, are allowed. The builtin implementation truncates values so floats are fully within the main screen grid. External GUIs could let floats hover outside of the main window like a tooltip, but this should not be used to specify arbitrary WM screen positions.

The returns the window handle or 0 when error.

func (*Nvim) Option

func (v *Nvim) Option(name string, result interface{}) error

Option gets an option.

func (*Nvim) OptionInfo added in v1.1.4

func (v *Nvim) OptionInfo(name string) (opinfo *OptionInfo, err error)

OptionInfo Gets the option information for one option.

Resulting dictionary has keys:

name

Name of the option (like 'filetype').

shortname

Shortened name of the option (like 'ft').

type

type of option ("string", "number" or "boolean").

default

The default value for the option.

was_set

Whether the option was set.

last_set_sid

Last set script id (if any).

last_set_linenr

line number where option was set.

last_set_chan

Channel where option was set (0 for local).

scope

one of "global", "win", or "buf".

global_local

whether win or buf option has a global value.

commalist

List of comma separated values.

flaglist
List of single char flags.

func (*Nvim) ParseExpression

func (v *Nvim) ParseExpression(expr string, flags string, highlight bool) (expression map[string]interface{}, err error)

ParseExpression parse a VimL expression.

func (*Nvim) Paste added in v1.0.2

func (v *Nvim) Paste(data string, crlf bool, phase int) (state bool, err error)

Paste pastes at cursor, in any mode.

Invokes the `vim.paste` handler, which handles each mode appropriately. Sets redo/undo. Faster than Input(). Lines break at LF ("\n").

Errors (`nomodifiable`, `vim.paste()` `failure` ...) are reflected in `err` but do not affect the return value (which is strictly decided by `vim.paste()`).

On error, subsequent calls are ignored ("drained") until the next paste is initiated (phase 1 or -1).

data

multiline input. May be binary (containing NUL bytes).

crlf

also break lines at CR and CRLF.

phase

-1 is paste in a single call (i.e. without streaming).

To `stream` a paste, call Paste sequentially with these `phase` args:

1

starts the paste (exactly once)

2

continues the paste (zero or more times)

3

ends the paste (exactly once)

The returned boolean state is:

true

Client may continue pasting.

false

Client must cancel the paste.

func (*Nvim) Proc

func (v *Nvim) Proc(pid int) (process Process, err error)

Proc gets info describing process `pid`.

func (*Nvim) ProcChildren

func (v *Nvim) ProcChildren(pid int) (processes []*Process, err error)

ProcChildren gets the immediate children of process `pid`.

func (*Nvim) Put added in v1.0.2

func (v *Nvim) Put(lines []string, typ string, after bool, follow bool) error

Put puts text at cursor, in any mode.

Compare :put and p which are always linewise.

lines is readfile() style list of lines.

type is edit behavior: any getregtype() result, or:

"b": blockwise-visual mode (may include width, e.g. "b3")
"c": characterwise mode
"l": linewise mode
"" : guess by contents, see setreg()

after is insert after cursor (like `p`), or before (like `P`).

follow is place cursor at end of inserted text.

func (*Nvim) RegisterHandler

func (v *Nvim) RegisterHandler(method string, fn interface{}) error

RegisterHandler registers fn as a MessagePack RPC handler for the named method. The function signature for fn is one of

func([v *nvim.Nvim,] {args}) ({resultType}, error)
func([v *nvim.Nvim,] {args}) error
func([v *nvim.Nvim,] {args})

where {args} is zero or more arguments and {resultType} is the type of a return value. Call the handler from Nvim using the rpcnotify and rpcrequest functions:

:help rpcrequest()
:help rpcnotify()

Plugin applications should use the Handler* methods in the ./plugin package to register handlers instead of this method.

func (*Nvim) ReplaceTermcodes

func (v *Nvim) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool) (input string, err error)

ReplaceTermcodes replaces any terminal code strings by byte sequences.

The returned sequences are Nvim's internal representation of keys, for example:

<esc> -> '\x1b'
<cr>  -> '\r'
<c-l> -> '\x0c'
<up>  -> '\x80ku'

The returned sequences can be used as input to feedkeys.

func (*Nvim) Request

func (v *Nvim) Request(procedure string, result interface{}, args ...interface{}) error

Request makes a RPC request.

func (*Nvim) RuntimeFiles added in v1.1.1

func (v *Nvim) RuntimeFiles(name string, all bool) (files []string, err error)

RuntimeFiles finds files in runtime directories and returns list of absolute paths to the found files.

The name arg is can contain wildcards. For example,

RuntimeFiles("colors/*.vim", true)

will return all color scheme files.

The all arg is whether to return all matches or only the first.

func (*Nvim) RuntimePaths

func (v *Nvim) RuntimePaths() (paths []string, err error)

RuntimePaths returns a list of paths contained in the runtimepath option.

func (*Nvim) SelectPopupmenuItem

func (v *Nvim) SelectPopupmenuItem(item int, insert bool, finish bool, opts map[string]interface{}) error

SelectPopupmenuItem selects an item in the completion popupmenu.

If |ins-completion| is not active this API call is silently ignored. Useful for an external UI using |ui-popupmenu| to control the popupmenu with the mouse. Can also be used in a mapping; use <cmd> |:map-cmd| to ensure the mapping doesn't end completion mode.

The `opts` optional parameters. Reserved for future use.

func (*Nvim) Serve

func (v *Nvim) Serve() error

Serve serves incoming mesages from the peer. Serve blocks until Nvim disconnects or there is an error.

By default, the NewChildProcess and Dial functions start a goroutine to run Serve(). Callers of the low-level New function are responsible for running Serve().

func (*Nvim) SetBufferExtmark added in v1.0.2

func (v *Nvim) SetBufferExtmark(buffer Buffer, nsID int, line int, col int, opts map[string]interface{}) (id int, err error)

SetBufferExtmark creates or updates an extmark.

To create a new extmark, pass id=0. The extmark id will be returned. To move an existing mark, pass its id.

It is also allowed to create a new mark by passing in a previously unused id, but the caller must then keep track of existing and unused ids itself. (Useful over RPC, to avoid waiting for the return value.)

Using the optional arguments, it is possible to use this to highlight a range of text, and also to associate virtual text to the mark.

The `opts` is additional options. Supports the string keys are:

id (value: int)

ID of the extmark to edit.

end_line (value: int)

Ending line of the mark, 0-based inclusive.

end_col (value: int)

Ending col of the mark, 0-based inclusive.

hl_group (value: string or int)

Name ar ID of the highlight group used to highlight this mark.

virt_text (value: VirtualTextChunk)

virtual text to link to this mark.

ephemeral (value: bool)

For use with SetDecorationProvider callbacks. The mark will only be used for the current redraw cycle, and not be permantently stored in the buffer.

func (*Nvim) SetBufferKeyMap added in v1.0.1

func (v *Nvim) SetBufferKeyMap(buffer Buffer, mode string, lhs string, rhs string, opts map[string]bool) error

SetBufferKeyMap sets a buffer-local mapping for the given mode.

See:

:help nvim_set_keymap()

func (*Nvim) SetBufferLines

func (v *Nvim) SetBufferLines(buffer Buffer, start int, end int, strict bool, replacement [][]byte) error

SetBufferLines replaces a line range on a buffer.

Indexing is zero-based, end-exclusive. Negative indices are interpreted as length+1+index, ie -1 refers to the index past the end. So to change or delete the last element set start=-2 and end=-1.

To insert lines at a given index, set both start and end to the same index. To delete a range of lines, set replacement to an empty array.

Out-of-bounds indices are clamped to the nearest valid value, unless strict = true.

func (*Nvim) SetBufferName

func (v *Nvim) SetBufferName(buffer Buffer, name string) error

SetBufferName sets the full file name of a buffer. BufFilePre/BufFilePost are triggered.

func (*Nvim) SetBufferOption

func (v *Nvim) SetBufferOption(buffer Buffer, name string, value interface{}) error

SetBufferOption sets a buffer option value. The value nil deletes the option in the case where there's a global fallback.

func (*Nvim) SetBufferText added in v1.1.6

func (v *Nvim) SetBufferText(buffer Buffer, startRow int, startCol int, endRow int, endCol int, replacement [][]byte) error

SetBufferText sets or replaces a range in the buffer.

This is recommended over SetBufferLines when only modifying parts of a line, as extmarks will be preserved on non-modified parts of the touched lines.

Indexing is zero-based and end-exclusive.

To insert text at a given index, set `start` and `end` ranges to the same index. To delete a range, set `replacement` to an array containing an empty string, or simply an empty array.

Prefer SetBufferLines when adding or deleting entire lines only.

func (*Nvim) SetBufferToWindow

func (v *Nvim) SetBufferToWindow(window Window, buffer Buffer) error

SetBufferToWindow sets the current buffer in a window, without side-effects.

func (*Nvim) SetBufferVar

func (v *Nvim) SetBufferVar(buffer Buffer, name string, value interface{}) error

SetBufferVar sets a buffer-scoped (b:) variable.

func (*Nvim) SetBufferVirtualText

func (v *Nvim) SetBufferVirtualText(buffer Buffer, nsID int, line int, chunks []VirtualTextChunk, opts map[string]interface{}) (id int, err error)

SetBufferVirtualText sets the virtual text (annotation) for a buffer line.

By default (and currently the only option) the text will be placed after the buffer text. Virtual text will never cause reflow, rather virtual text will be truncated at the end of the screen line. The virtual text will begin one cell (|lcs-eol| or space) after the ordinary text.

Namespaces are used to support batch deletion/updating of virtual text. To create a namespace, use CreateNamespace(). Virtual text is cleared using ClearBufferNamespace(). The same `nsID` can be used for both virtual text and highlights added by AddBufferHighlight(), both can then be cleared with a single call to ClearBufferNamespace(). If the virtual text never will be cleared by an API call, pass `nsID = -1`.

As a shorthand, `nsID = 0` can be used to create a new namespace for the virtual text, the allocated id is then returned.

The `opts` is optional parameters. Currently not used.

The returns the nsID that was used.

func (*Nvim) SetClientInfo

func (v *Nvim) SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes) error

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 (*Nvim) SetCurrentBuffer

func (v *Nvim) SetCurrentBuffer(buffer Buffer) error

SetCurrentBuffer sets the current buffer.

func (*Nvim) SetCurrentDirectory

func (v *Nvim) SetCurrentDirectory(dir string) error

SetCurrentDirectory changes the Vim working directory.

func (*Nvim) SetCurrentLine

func (v *Nvim) SetCurrentLine(line []byte) error

SetCurrentLine sets the current line in the current buffer.

func (*Nvim) SetCurrentTabpage

func (v *Nvim) SetCurrentTabpage(tabpage Tabpage) error

SetCurrentTabpage sets the current tabpage.

func (*Nvim) SetCurrentWindow

func (v *Nvim) SetCurrentWindow(window Window) error

SetCurrentWindow sets the current window.

func (*Nvim) SetHighlight added in v1.1.4

func (v *Nvim) SetHighlight(nsID int, name string, val *HLAttrs) error

SetHighlight set a highlight group.

name arg is highlight group name, like ErrorMsg.

val arg is highlight definiton map, like HLByName.

func (*Nvim) SetHighlightNameSpace added in v1.1.4

func (v *Nvim) SetHighlightNameSpace(nsID int) error

SetHighlightNameSpace set active namespace for highlights.

NB: this function can be called from async contexts, but the semantics are not yet well-defined. To start with SetDecorationProvider on_win and on_line callbacks are explicitly allowed to change the namespace during a redraw cycle.

The `nsID` arg is the namespace to activate.

func (*Nvim) SetKeyMap added in v1.0.1

func (v *Nvim) SetKeyMap(mode string, lhs string, rhs string, opts map[string]bool) error

SetKeyMap sets a global mapping for the given mode.

To set a buffer-local mapping, use SetBufferKeyMap().

Unlike :map, leading/trailing whitespace is accepted as part of the {lhs} or {rhs}. Empty {rhs} is <Nop>. keycodes are replaced as usual.

mode

mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for :map!, or empty string for :map.

lhs

Left-hand-side {lhs} of the mapping.

rhs

Right-hand-side {rhs} of the mapping.

opts

Optional parameters map. Accepts all :map-arguments as keys excluding <buffer> but including noremap. Values are Booleans. Unknown key is an error.

func (*Nvim) SetOption

func (v *Nvim) SetOption(name string, value interface{}) error

SetOption sets an option.

func (*Nvim) SetPumBounds added in v1.1.4

func (v *Nvim) SetPumBounds(width float64, height float64, row float64, col float64) error

SetPumBounds tells Nvim the geometry of the popumenu, to align floating windows with an external popup menu.

Note that this method is not to be confused with SetPumHeight, which sets the number of visible items in the popup menu, while this function sets the bounding box of the popup menu, including visual elements such as borders and sliders.

Floats need not use the same font size, nor be anchored to exact grid corners, so one can set floating-point numbers to the popup menu geometry.

func (*Nvim) SetPumHeight added in v1.0.2

func (v *Nvim) SetPumHeight(height int) error

SetPumHeight tells Nvim the number of elements displaying in the popumenu, to decide <PageUp> and <PageDown> movement.

height is popupmenu height, must be greater than zero.

func (*Nvim) SetTabpageVar

func (v *Nvim) SetTabpageVar(tabpage Tabpage, name string, value interface{}) error

SetTabpageVar sets a tab-scoped (t:) variable.

func (*Nvim) SetUIOption

func (v *Nvim) SetUIOption(name string, value interface{}) error

SetUIOption sets a UI option.

func (*Nvim) SetVVar

func (v *Nvim) SetVVar(name string, value interface{}) error

SetVVar sets a v: variable, if it is not readonly.

func (*Nvim) SetVar

func (v *Nvim) SetVar(name string, value interface{}) error

SetVar sets a global (g:) variable.

func (*Nvim) SetWindowConfig

func (v *Nvim) SetWindowConfig(window Window, config *WindowConfig) error

SetWindowConfig configure window position. Currently this is only used to configure floating and external windows (including changing a split window to these types).

See documentation at OpenWindow, for the meaning of parameters.

When reconfiguring a floating window, absent option keys will not be changed. The following restriction are apply must be reconfigured together. Only changing a subset of these is an error.

row
col
relative

func (*Nvim) SetWindowCursor

func (v *Nvim) SetWindowCursor(window Window, pos [2]int) error

SetWindowCursor sets the cursor position in the window to the given position.

func (*Nvim) SetWindowHeight

func (v *Nvim) SetWindowHeight(window Window, height int) error

SetWindowHeight sets the window height.

func (*Nvim) SetWindowOption

func (v *Nvim) SetWindowOption(window Window, name string, value interface{}) error

SetWindowOption sets a window option.

func (*Nvim) SetWindowVar

func (v *Nvim) SetWindowVar(window Window, name string, value interface{}) error

SetWindowVar sets a window-scoped (w:) variable.

func (*Nvim) SetWindowWidth

func (v *Nvim) SetWindowWidth(window Window, width int) error

SetWindowWidth sets the window width.

func (*Nvim) StringWidth

func (v *Nvim) StringWidth(s string) (width int, err error)

StringWidth returns the number of display cells the string occupies. Tab is counted as one cell.

func (*Nvim) Subscribe

func (v *Nvim) Subscribe(event string) error

Subscribe subscribes to a Nvim event.

func (*Nvim) TabpageNumber

func (v *Nvim) TabpageNumber(tabpage Tabpage) (number int, err error)

TabpageNumber gets the tabpage number from the tabpage handle.

func (*Nvim) TabpageVar

func (v *Nvim) TabpageVar(tabpage Tabpage, name string, result interface{}) error

TabpageVar gets a tab-scoped (t:) variable.

func (*Nvim) TabpageWindow

func (v *Nvim) TabpageWindow(tabpage Tabpage) (Window, error)

TabpageWindow gets the current window in a tab page.

func (*Nvim) TabpageWindows

func (v *Nvim) TabpageWindows(tabpage Tabpage) (windows []Window, err error)

TabpageWindows returns the windows in a tabpage.

func (*Nvim) Tabpages

func (v *Nvim) Tabpages() (tabpages []Tabpage, err error)

Tabpages returns the current list of tabpages.

func (*Nvim) TryResizeUI

func (v *Nvim) TryResizeUI(width int, height int) error

TryResizeUI notifies Nvim that the client window has resized. If possible, Nvim will send a redraw request to resize.

func (*Nvim) TryResizeUIGrid

func (v *Nvim) TryResizeUIGrid(grid int, width int, height int) error

TryResizeUIGrid tell Nvim to resize a grid. Triggers a grid_resize event with the requested grid size or the maximum size if it exceeds size limits.

On invalid grid handle, fails with error.

func (*Nvim) UIs

func (v *Nvim) UIs() (uis []*UI, err error)

UIs gets a list of dictionaries representing attached UIs.

func (*Nvim) Unsubscribe

func (v *Nvim) Unsubscribe(event string) error

Unsubscribe unsubscribes to a Nvim event.

func (*Nvim) VVar

func (v *Nvim) VVar(name string, result interface{}) error

VVar gets a vim (v:) variable.

func (*Nvim) Var

func (v *Nvim) Var(name string, result interface{}) error

Var gets a global (g:) variable.

func (*Nvim) WindowBuffer

func (v *Nvim) WindowBuffer(window Window) (buffer Buffer, err error)

WindowBuffer returns the current buffer in a window.

func (*Nvim) WindowConfig

func (v *Nvim) WindowConfig(window Window) (config *WindowConfig, err error)

WindowConfig return window configuration.

Return a dictionary containing the same config that can be given to OpenWindow.

The `relative` will be an empty string for normal windows.

func (*Nvim) WindowCursor

func (v *Nvim) WindowCursor(window Window) (pos [2]int, err error)

WindowCursor returns the cursor position in the window.

func (*Nvim) WindowHeight

func (v *Nvim) WindowHeight(window Window) (height int, err error)

WindowHeight returns the window height.

func (*Nvim) WindowNumber

func (v *Nvim) WindowNumber(window Window) (number int, err error)

WindowNumber gets the window number from the window handle.

func (*Nvim) WindowOption

func (v *Nvim) WindowOption(window Window, name string, result interface{}) error

WindowOption gets a window option.

func (*Nvim) WindowPosition

func (v *Nvim) WindowPosition(window Window) (pos [2]int, err error)

WindowPosition gets the window position in display cells. First position is zero.

func (*Nvim) WindowTabpage

func (v *Nvim) WindowTabpage(window Window) (tabpage Tabpage, err error)

WindowTabpage gets the tab page that contains the window.

func (*Nvim) WindowVar

func (v *Nvim) WindowVar(window Window, name string, result interface{}) error

WindowVar gets a window-scoped (w:) variable.

func (*Nvim) WindowWidth

func (v *Nvim) WindowWidth(window Window) (width int, err error)

WindowWidth returns the window width.

func (*Nvim) Windows

func (v *Nvim) Windows() (windows []Window, err error)

Windows returns the current list of windows.

func (*Nvim) WriteErr

func (v *Nvim) WriteErr(str string) error

WriteErr writes a message to vim error buffer. The string is split and flushed after each newline. Incomplete lines are kept for writing later.

func (*Nvim) WriteOut

func (v *Nvim) WriteOut(str string) error

WriteOut writes a message to vim output buffer. The string is split and flushed after each newline. Incomplete lines are kept for writing later.

func (*Nvim) WritelnErr

func (v *Nvim) WritelnErr(str string) error

WritelnErr writes prints str and a newline as an error message.

type OptionInfo added in v1.1.4

type OptionInfo struct {
	// Name is the name of the option (like 'filetype').
	Name string `msgpack:"name"`

	// ShortName is the shortened name of the option (like 'ft').
	ShortName string `msgpack:"shortname"`

	// Type is the type of option ("string", "number" or "boolean").
	Type string `msgpack:"type"`

	// Default is the default value for the option.
	Default interface{} `msgpack:"default"`

	// Scope one of "global", "win", or "buf".
	Scope string `msgpack:"scope"`

	// LastSetSid is the last set script id (if any).
	LastSetSid int `msgpack:"last_set_sid"`

	// LastSetLinenr is the line number where option was set.
	LastSetLinenr int `msgpack:"last_set_linenr"`

	// LastSetChan is the channel where option was set (0 for local).
	LastSetChan int `msgpack:"last_set_chan"`

	// WasSet whether the option was set.
	WasSet bool `msgpack:"was_set"`

	// GlobalLocal whether win or buf option has a global value.
	GlobalLocal bool `msgpack:"global_local"`

	// CommaList whether the list of comma separated values.
	CommaList bool `msgpack:"commalist"`

	// FlagList whether the list of single char flags.
	FlagList bool `msgpack:"flaglist"`
}

OptionInfo represents a option information.

type Process

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"`
}

Process represents a Proc and ProcChildren functions return type.

type QuickfixError

type QuickfixError struct {
	// Buffer number
	Bufnr int `msgpack:"bufnr,omitempty"`

	// Line number in the file.
	LNum int `msgpack:"lnum,omitempty"`

	// Search pattern used to locate the error.
	Pattern string `msgpack:"pattern,omitempty"`

	// Column number (first column is 1).
	Col int `msgpack:"col,omitempty"`

	// When Vcol is != 0,  Col is visual column.
	VCol int `msgpack:"vcol,omitempty"`

	// Error number.
	Nr int `msgpack:"nr,omitempty"`

	// Description of the error.
	Text string `msgpack:"text,omitempty"`

	// Single-character error type, 'E', 'W', etc.
	Type string `msgpack:"type,omitempty"`

	// Name of a file; only used when bufnr is not present or it is invalid.
	FileName string `msgpack:"filename,omitempty"`

	// Valid is non-zero if this is a recognized error message.
	Valid int `msgpack:"valid,omitempty"`

	// Module name of a module. If given it will be used in quickfix error window instead of the filename.
	Module string `msgpack:"module,omitempty"`
}

QuickfixError represents an item in a quickfix list.

type Tabpage

type Tabpage int

Tabpage represents a Nvim tabpage.

func (Tabpage) MarshalMsgPack

func (x Tabpage) MarshalMsgPack(enc *msgpack.Encoder) error

MarshalMsgPack implements msgpack.Marshaler.

func (Tabpage) String

func (x Tabpage) String() string

String returns a string representation of the Tabpage.

func (*Tabpage) UnmarshalMsgPack

func (x *Tabpage) UnmarshalMsgPack(dec *msgpack.Decoder) error

UnmarshalMsgPack implements msgpack.Unmarshaler.

type UI

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"`
}

UI represents a nvim ui options.

type VirtualTextChunk

type VirtualTextChunk struct {
	// Text is VirtualText text.
	Text string `msgpack:",array"`

	// HLGroup is VirtualText highlight group.
	HLGroup string
}

VirtualTextChunk represents a virtual text chunk.

type Window

type Window int

Window represents a Nvim window.

func (Window) MarshalMsgPack

func (x Window) MarshalMsgPack(enc *msgpack.Encoder) error

MarshalMsgPack implements msgpack.Marshaler.

func (Window) String

func (x Window) String() string

String returns a string representation of the Window.

func (*Window) UnmarshalMsgPack

func (x *Window) UnmarshalMsgPack(dec *msgpack.Decoder) error

UnmarshalMsgPack implements msgpack.Unmarshaler.

type WindowConfig added in v1.0.1

type WindowConfig struct {
	// Relative is the specifies the type of positioning method used for the floating window.
	Relative string `msgpack:"relative,omitempty"`

	// Win is the Window for relative="win".
	Win Window `msgpack:"win,omitempty"`

	// Anchor is the decides which corner of the float to place at row and col.
	Anchor string `msgpack:"anchor,omitempty" empty:"NW"`

	// Width is the window width (in character cells). Minimum of 1.
	Width int `msgpack:"width" empty:"1"`

	// Height is the window height (in character cells). Minimum of 1.
	Height int `msgpack:"height" empty:"1"`

	// BufPos places float relative to buffer text only when relative="win".
	BufPos [2]int `msgpack:"bufpos,omitempty"`

	// Row is the row position in units of "screen cell height", may be fractional.
	Row float64 `msgpack:"row,omitempty"`

	// Col is the column position in units of "screen cell width", may be fractional.
	Col float64 `msgpack:"col,omitempty"`

	// Focusable whether the enable focus by user actions (wincmds, mouse events).
	Focusable bool `msgpack:"focusable,omitempty" empty:"true"`

	// External is the GUI should display the window as an external top-level window.
	External bool `msgpack:"external,omitempty"`

	// Style is the Configure the appearance of the window.
	Style string `msgpack:"style,omitempty"`
}

WindowConfig represents a configs of OpenWindow.

Relative is the specifies the type of positioning method used for the floating window. The positioning method string keys names:

editor

The global editor grid.

win

Window given by the `win` field, or current window by default.

cursor

Cursor position in current window.

Anchor is the decides which corner of the float to place at row and col.

NW

northwest (default)

NE

northeast

SW

southwest

SE

southeast

BufPos places float relative to buffer text only when Relative == "win". Takes a tuple of zero-indexed [line, column].

Row and Col if given are applied relative to this position, else they default to Row=1 and Col=0 (thus like a tooltip near the buffer text).

Row is the row position in units of "screen cell height", may be fractional.

Col is the column position in units of "screen cell width", may be fractional.

Focusable whether the enable focus by user actions (wincmds, mouse events). Defaults to true. Non-focusable windows can be entered by SetCurrentWindow.

External is the GUI should display the window as an external top-level window. Currently accepts no other positioning configuration together with this.

Style is the Configure the appearance of the window. Currently only takes one non-empty value:

minimal

Nvim will display the window with many UI options disabled. This is useful when displaying a temporary float where the text should not be edited.

Disables `number`, `relativenumber`, `cursorline`, `cursorcolumn`, `foldcolumn`, `spell` and `list` options. And, `signcolumn` is changed to `auto` and `colorcolumn` is cleared.

The end-of-buffer region is hidden by setting `eob` flag of `fillchars` to a space char, and clearing the EndOfBuffer region in `winhighlight`.

Directories

Path Synopsis
Package plugin is a Nvim remote plugin host.
Package plugin is a Nvim remote plugin host.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL