go-client: github.com/neovim/go-client/nvim Index | Files | Directories

package nvim

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

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 New or NewEmbedded functions and call the Serve() method to process RPC messages. 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.

Index

Package Files

apiimp.go doc.go helpers.go nvim.go

func NewBufferReader Uses

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.

type Batch Uses

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 Uses

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

func (*Batch) AddBufferHighlight Uses

func (b *Batch) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int, result *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. Succesive 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 synchrounously 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) AttachUI Uses

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 Uses

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

BufferChangedTick gets a changed tick of a buffer.

func (*Batch) BufferLineCount Uses

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

BufferLineCount returns the number of lines in the buffer.

func (*Batch) BufferLines Uses

func (b *Batch) BufferLines(buffer Buffer, start int, end int, strict bool, result *[][]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 Uses

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

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

func (*Batch) BufferName Uses

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

BufferName gets the full file name of a buffer.

func (*Batch) BufferNumber Uses

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

BufferNumber gets a buffer's number.

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

func (*Batch) BufferOption Uses

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

BufferOption gets a buffer option value.

func (*Batch) BufferVar Uses

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

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

func (*Batch) Buffers Uses

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

Buffers returns the current list of buffers.

func (*Batch) Call Uses

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

Call calls a vimscript function.

func (*Batch) ClearBufferHighlight Uses

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.

func (*Batch) ColorByName Uses

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

func (*Batch) ColorMap Uses

func (b *Batch) ColorMap(result *map[string]interface{})

func (*Batch) Command Uses

func (b *Batch) Command(cmd string)

Command executes a single ex command.

func (*Batch) CommandOutput Uses

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

CommandOutput executes a single ex command and returns the output.

func (*Batch) CurrentBuffer Uses

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

CurrentBuffer returns the current buffer.

func (*Batch) CurrentLine Uses

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

CurrentLine gets the current line in the current buffer.

func (*Batch) CurrentTabpage Uses

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

CurrentTabpage returns the current tabpage.

func (*Batch) CurrentWindow Uses

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

CurrentWindow returns the current window.

func (*Batch) DeleteBufferVar Uses

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

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

func (*Batch) DeleteCurrentLine Uses

func (b *Batch) DeleteCurrentLine()

DeleteCurrentLine deletes the current line in the current buffer.

func (*Batch) DeleteTabpageVar Uses

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

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

func (*Batch) DeleteVar Uses

func (b *Batch) DeleteVar(name string)

DeleteVar removes a global (g:) variable.

func (*Batch) DeleteWindowVar Uses

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

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

func (*Batch) DetachUI Uses

func (b *Batch) DetachUI()

DetachUI unregisters the client as a remote UI.

func (*Batch) Eval Uses

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

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

:help expression

func (*Batch) Execute Uses

func (b *Batch) Execute() error

Execute executes the API function calls in the batch.

func (*Batch) ExecuteLua Uses

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

ExecuteLua executes a Lua block.

func (*Batch) FeedKeys Uses

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) Input Uses

func (b *Batch) Input(keys string, result *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) IsBufferValid Uses

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

IsBufferValid returns true if the buffer is valid.

func (*Batch) IsTabpageValid Uses

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

IsTabpageValid checks if a tab page is valid.

func (*Batch) IsWindowValid Uses

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

IsWindowValid returns true if the window is valid.

func (*Batch) Mode Uses

func (b *Batch) Mode(result *Mode)

Mode gets Nvim's current mode.

func (*Batch) Option Uses

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

Option gets an option.

func (*Batch) ReplaceTermcodes Uses

func (b *Batch) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool, result *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) RuntimePaths Uses

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

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

func (*Batch) SetBufferLines Uses

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 Uses

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

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

func (*Batch) SetBufferOption Uses

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) SetBufferVar Uses

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

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

func (*Batch) SetCurrentBuffer Uses

func (b *Batch) SetCurrentBuffer(buffer Buffer)

SetCurrentBuffer sets the current buffer.

func (*Batch) SetCurrentDirectory Uses

func (b *Batch) SetCurrentDirectory(dir string)

SetCurrentDirectory changes the Vim working directory.

func (*Batch) SetCurrentLine Uses

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

SetCurrentLine sets the current line in the current buffer.

func (*Batch) SetCurrentTabpage Uses

func (b *Batch) SetCurrentTabpage(tabpage Tabpage)

SetCurrentTabpage sets the current tabpage.

func (*Batch) SetCurrentWindow Uses

func (b *Batch) SetCurrentWindow(window Window)

SetCurrentWindow sets the current window.

func (*Batch) SetOption Uses

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

SetOption sets an option.

func (*Batch) SetTabpageVar Uses

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

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

func (*Batch) SetUIOption Uses

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

SetUIOption sets a UI option.

func (*Batch) SetVar Uses

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

SetVar sets a global (g:) variable.

func (*Batch) SetWindowCursor Uses

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

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

func (*Batch) SetWindowHeight Uses

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

SetWindowHeight sets the window height.

func (*Batch) SetWindowOption Uses

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

SetWindowOption sets a window option.

func (*Batch) SetWindowVar Uses

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

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

func (*Batch) SetWindowWidth Uses

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

SetWindowWidth sets the window width.

func (*Batch) StringWidth Uses

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

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

func (*Batch) Subscribe Uses

func (b *Batch) Subscribe(event string)

Subscribe subscribes to a Nvim event.

func (*Batch) TabpageNumber Uses

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

TabpageNumber gets the tabpage number from the tabpage handle.

func (*Batch) TabpageVar Uses

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

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

func (*Batch) TabpageWindow Uses

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

TabpageWindow gets the current window in a tab page.

func (*Batch) TabpageWindows Uses

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

TabpageWindows returns the windows in a tabpage.

func (*Batch) Tabpages Uses

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

Tabpages returns the current list of tabpages.

func (*Batch) TryResizeUI Uses

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) Unsubscribe Uses

func (b *Batch) Unsubscribe(event string)

Unsubscribe unsubscribes to a Nvim event.

func (*Batch) VVar Uses

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

VVar gets a vim (v:) variable.

func (*Batch) Var Uses

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

Var gets a global (g:) variable.

func (*Batch) WindowBuffer Uses

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

WindowBuffer returns the current buffer in a window.

func (*Batch) WindowCursor Uses

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

WindowCursor returns the cursor position in the window.

func (*Batch) WindowHeight Uses

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

WindowHeight returns the window height.

func (*Batch) WindowNumber Uses

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

WindowNumber gets the window number from the window handle.

func (*Batch) WindowOption Uses

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

WindowOption gets a window option.

func (*Batch) WindowPosition Uses

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

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

func (*Batch) WindowTabpage Uses

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

WindowTabpage gets the tab page that contains the window.

func (*Batch) WindowVar Uses

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

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

func (*Batch) WindowWidth Uses

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

WindowWidth returns the window width.

func (*Batch) Windows Uses

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

Windows returns the current list of windows.

func (*Batch) WriteErr Uses

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 Uses

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 Uses

func (b *Batch) WritelnErr(str string)

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

type BatchError Uses

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 Uses

func (e *BatchError) Error() string

type Buffer Uses

type Buffer int

Buffer represents a remote Nvim buffer.

func (Buffer) MarshalMsgPack Uses

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

func (Buffer) String Uses

func (x Buffer) String() string

func (*Buffer) UnmarshalMsgPack Uses

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

type CommandCompletionArgs Uses

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 string
}

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

:help :command-completion-custom

func (*CommandCompletionArgs) CursorPos Uses

func (a *CommandCompletionArgs) CursorPos() int

CursorPos returns the cursor position.

type EmbedOptions Uses

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.

type ErrorList Uses

type ErrorList []error

ErrorList is a list of errors.

func (ErrorList) Error Uses

func (el ErrorList) Error() string

type Mode Uses

type Mode struct {
    // Mode is the current mode.
    Mode string `msgpack:"mode"`

    // Blocking is true if Nvim is waiting for input.
    Blocking bool `msgpack:"blocking"`
}

type Nvim Uses

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

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

func New Uses

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.

:help rpc-connecting

func NewEmbedded Uses

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

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

func (*Nvim) APIInfo Uses

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

func (*Nvim) AddBufferHighlight Uses

func (v *Nvim) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int) (int, 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. Succesive 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 synchrounously 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) AttachUI Uses

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 Uses

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

BufferChangedTick gets a changed tick of a buffer.

func (*Nvim) BufferLineCount Uses

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

BufferLineCount returns the number of lines in the buffer.

func (*Nvim) BufferLines Uses

func (v *Nvim) BufferLines(buffer Buffer, start int, end int, strict bool) ([][]byte, 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 Uses

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

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

func (*Nvim) BufferName Uses

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

BufferName gets the full file name of a buffer.

func (*Nvim) BufferNumber Uses

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

BufferNumber gets a buffer's number.

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

func (*Nvim) BufferOption Uses

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

BufferOption gets a buffer option value.

func (*Nvim) BufferVar Uses

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

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

func (*Nvim) Buffers Uses

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

Buffers returns the current list of buffers.

func (*Nvim) Call Uses

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

Call calls a vimscript function.

func (*Nvim) ChannelID Uses

func (v *Nvim) ChannelID() int

ChannelID returns Nvim's channel id for this client.

func (*Nvim) ClearBufferHighlight Uses

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.

func (*Nvim) Close Uses

func (v *Nvim) Close() error

Close releases the resources used the client.

func (*Nvim) ColorByName Uses

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

func (*Nvim) ColorMap Uses

func (v *Nvim) ColorMap() (map[string]interface{}, error)

func (*Nvim) Command Uses

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

Command executes a single ex command.

func (*Nvim) CommandOutput Uses

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

CommandOutput executes a single ex command and returns the output.

func (*Nvim) CurrentBuffer Uses

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

CurrentBuffer returns the current buffer.

func (*Nvim) CurrentLine Uses

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

CurrentLine gets the current line in the current buffer.

func (*Nvim) CurrentTabpage Uses

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

CurrentTabpage returns the current tabpage.

func (*Nvim) CurrentWindow Uses

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

CurrentWindow returns the current window.

func (*Nvim) DeleteBufferVar Uses

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

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

func (*Nvim) DeleteCurrentLine Uses

func (v *Nvim) DeleteCurrentLine() error

DeleteCurrentLine deletes the current line in the current buffer.

func (*Nvim) DeleteTabpageVar Uses

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

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

func (*Nvim) DeleteVar Uses

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

DeleteVar removes a global (g:) variable.

func (*Nvim) DeleteWindowVar Uses

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

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

func (*Nvim) DetachUI Uses

func (v *Nvim) DetachUI() error

DetachUI unregisters the client as a remote UI.

func (*Nvim) Eval Uses

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

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

:help expression

func (*Nvim) ExecuteLua Uses

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

ExecuteLua executes a Lua block.

func (*Nvim) FeedKeys Uses

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) Input Uses

func (v *Nvim) Input(keys string) (int, 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) IsBufferValid Uses

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

IsBufferValid returns true if the buffer is valid.

func (*Nvim) IsTabpageValid Uses

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

IsTabpageValid checks if a tab page is valid.

func (*Nvim) IsWindowValid Uses

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

IsWindowValid returns true if the window is valid.

func (*Nvim) Mode Uses

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

Mode gets Nvim's current mode.

func (*Nvim) NewBatch Uses

func (v *Nvim) NewBatch() *Batch

NewBatch creates a new batch.

func (*Nvim) Option Uses

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

Option gets an option.

func (*Nvim) RegisterHandler Uses

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 Uses

func (v *Nvim) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool) (string, 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) RuntimePaths Uses

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

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

func (*Nvim) Serve Uses

func (v *Nvim) Serve() error

Serve serves incoming requests. Serve blocks until Nvim disconnects or there is an error.

func (*Nvim) SetBufferLines Uses

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 Uses

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 Uses

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) SetBufferVar Uses

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

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

func (*Nvim) SetCurrentBuffer Uses

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

SetCurrentBuffer sets the current buffer.

func (*Nvim) SetCurrentDirectory Uses

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

SetCurrentDirectory changes the Vim working directory.

func (*Nvim) SetCurrentLine Uses

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

SetCurrentLine sets the current line in the current buffer.

func (*Nvim) SetCurrentTabpage Uses

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

SetCurrentTabpage sets the current tabpage.

func (*Nvim) SetCurrentWindow Uses

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

SetCurrentWindow sets the current window.

func (*Nvim) SetOption Uses

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

SetOption sets an option.

func (*Nvim) SetTabpageVar Uses

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

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

func (*Nvim) SetUIOption Uses

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

SetUIOption sets a UI option.

func (*Nvim) SetVar Uses

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

SetVar sets a global (g:) variable.

func (*Nvim) SetWindowCursor Uses

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 Uses

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

SetWindowHeight sets the window height.

func (*Nvim) SetWindowOption Uses

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

SetWindowOption sets a window option.

func (*Nvim) SetWindowVar Uses

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

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

func (*Nvim) SetWindowWidth Uses

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

SetWindowWidth sets the window width.

func (*Nvim) StringWidth Uses

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

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

func (*Nvim) Subscribe Uses

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

Subscribe subscribes to a Nvim event.

func (*Nvim) TabpageNumber Uses

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

TabpageNumber gets the tabpage number from the tabpage handle.

func (*Nvim) TabpageVar Uses

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

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

func (*Nvim) TabpageWindow Uses

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

TabpageWindow gets the current window in a tab page.

func (*Nvim) TabpageWindows Uses

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

TabpageWindows returns the windows in a tabpage.

func (*Nvim) Tabpages Uses

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

Tabpages returns the current list of tabpages.

func (*Nvim) TryResizeUI Uses

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) Unsubscribe Uses

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

Unsubscribe unsubscribes to a Nvim event.

func (*Nvim) VVar Uses

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

VVar gets a vim (v:) variable.

func (*Nvim) Var Uses

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

Var gets a global (g:) variable.

func (*Nvim) WindowBuffer Uses

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

WindowBuffer returns the current buffer in a window.

func (*Nvim) WindowCursor Uses

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

WindowCursor returns the cursor position in the window.

func (*Nvim) WindowHeight Uses

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

WindowHeight returns the window height.

func (*Nvim) WindowNumber Uses

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

WindowNumber gets the window number from the window handle.

func (*Nvim) WindowOption Uses

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

WindowOption gets a window option.

func (*Nvim) WindowPosition Uses

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

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

func (*Nvim) WindowTabpage Uses

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

WindowTabpage gets the tab page that contains the window.

func (*Nvim) WindowVar Uses

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

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

func (*Nvim) WindowWidth Uses

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

WindowWidth returns the window width.

func (*Nvim) Windows Uses

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

Windows returns the current list of windows.

func (*Nvim) WriteErr Uses

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 Uses

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 Uses

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

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

type QuickfixError Uses

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

QuickfixError represents an item in a quickfix list.

type Tabpage Uses

type Tabpage int

Tabpage represents a remote Nvim tabpage.

func (Tabpage) MarshalMsgPack Uses

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

func (Tabpage) String Uses

func (x Tabpage) String() string

func (*Tabpage) UnmarshalMsgPack Uses

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

type Window Uses

type Window int

Window represents a remote Nvim window.

func (Window) MarshalMsgPack Uses

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

func (Window) String Uses

func (x Window) String() string

func (*Window) UnmarshalMsgPack Uses

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

Directories

PathSynopsis
pluginPackage plugin is a Nvim remote plugin host.

Package nvim imports 11 packages (graph) and is imported by 17 packages. Updated 2017-06-24. Refresh now. Tools for package owners.