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 ¶
- Constants
- func NewBufferReader(v *Nvim, b Buffer) io.Reader
- type Batch
- func (b *Batch) APIInfo(apiInfo *[]interface{})
- func (b *Batch) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int, ...)
- func (b *Batch) AllOptionsInfo(opinfo *OptionInfo)
- func (b *Batch) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}, attached *bool)
- func (b *Batch) AttachUI(width int, height int, options map[string]interface{})
- func (b *Batch) BufferChangedTick(buffer Buffer, changedtick *int)
- func (b *Batch) BufferCommands(buffer Buffer, opts map[string]interface{}, result *map[string]*Command)
- func (b *Batch) BufferExtmarkByID(buffer Buffer, nsID int, id int, opt map[string]interface{}, pos *[]int)
- func (b *Batch) BufferExtmarks(buffer Buffer, nsID int, start interface{}, end interface{}, ...)
- func (b *Batch) BufferKeyMap(buffer Buffer, mode string, result *[]*Mapping)
- func (b *Batch) BufferLineCount(buffer Buffer, count *int)
- func (b *Batch) BufferLines(buffer Buffer, start int, end int, strict bool, lines *[][]byte)
- func (b *Batch) BufferMark(buffer Buffer, name string, pos *[2]int)
- func (b *Batch) BufferName(buffer Buffer, name *string)
- func (b *Batch) BufferNumber(buffer Buffer, number *int)deprecated
- func (b *Batch) BufferOffset(buffer Buffer, index int, offset *int)
- func (b *Batch) BufferOption(buffer Buffer, name string, result interface{})
- func (b *Batch) BufferVar(buffer Buffer, name string, result interface{})
- func (b *Batch) Buffers(buffers *[]Buffer)
- func (b *Batch) Call(fname string, result interface{}, args ...interface{})
- func (b *Batch) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{})
- func (b *Batch) ChannelInfo(channelID int, channel *Channel)
- func (b *Batch) Channels(channels *[]*Channel)
- func (b *Batch) ClearBufferHighlight(buffer Buffer, srcID int, startLine int, endLine int)deprecated
- func (b *Batch) ClearBufferNamespace(buffer Buffer, nsID int, lineStart int, lineEnd int)
- func (b *Batch) CloseWindow(window Window, force bool)
- func (b *Batch) ColorByName(name string, color *int)
- func (b *Batch) ColorMap(colorMap *map[string]int)
- func (b *Batch) Command(cmd string)
- func (b *Batch) CommandOutput(cmd string, out *string)deprecated
- func (b *Batch) Commands(opts map[string]interface{}, commands *map[string]*Command)
- func (b *Batch) Context(opts map[string][]string, contexts *map[string]interface{})
- func (b *Batch) CreateBuffer(listed bool, scratch bool, buffer *Buffer)
- func (b *Batch) CreateNamespace(name string, nsID *int)
- func (b *Batch) CurrentBuffer(buffer *Buffer)
- func (b *Batch) CurrentLine(line *[]byte)
- func (b *Batch) CurrentTabpage(tabpage *Tabpage)
- func (b *Batch) CurrentWindow(window *Window)
- func (b *Batch) DeleteBuffer(buffer Buffer, opts map[string]bool)
- func (b *Batch) DeleteBufferExtmark(buffer Buffer, nsID int, extmarkID int, deleted *bool)
- func (b *Batch) DeleteBufferKeyMap(buffer Buffer, mode string, lhs string)
- func (b *Batch) DeleteBufferVar(buffer Buffer, name string)
- func (b *Batch) DeleteCurrentLine()
- func (b *Batch) DeleteKeyMap(mode string, lhs string)
- func (b *Batch) DeleteTabpageVar(tabpage Tabpage, name string)
- func (b *Batch) DeleteVar(name string)
- func (b *Batch) DeleteWindowVar(window Window, name string)
- func (b *Batch) DetachBuffer(buffer Buffer, detached *bool)
- func (b *Batch) DetachUI()
- func (b *Batch) Echo(chunks []EchoChunk, history bool, opts map[string]interface{})
- func (b *Batch) Eval(expr string, result interface{})
- func (b *Batch) Exec(src string, output bool, out *string)
- func (b *Batch) ExecLua(code string, result interface{}, args ...interface{})
- func (b *Batch) Execute() error
- func (b *Batch) ExecuteLua(code string, result interface{}, args ...interface{})deprecated
- func (b *Batch) FeedKeys(keys string, mode string, escapeCSI bool)
- func (b *Batch) HLByID(id int, rgb bool, highlight *HLAttrs)
- func (b *Batch) HLByName(name string, rgb bool, highlight *HLAttrs)
- func (b *Batch) HLIDByName(name string, highlightID *int)
- func (b *Batch) Input(keys string, written *int)
- func (b *Batch) InputMouse(button string, action string, modifier string, grid int, row int, col int)
- func (b *Batch) IsBufferLoaded(buffer Buffer, loaded *bool)
- func (b *Batch) IsBufferValid(buffer Buffer, valied *bool)
- func (b *Batch) IsTabpageValid(tabpage Tabpage, valid *bool)
- func (b *Batch) IsWindowValid(window Window, valid *bool)
- func (b *Batch) KeyMap(mode string, maps *[]*Mapping)
- func (b *Batch) LoadContext(dict map[string]interface{}, result interface{})
- func (b *Batch) Mode(mode *Mode)
- func (b *Batch) Namespaces(namespaces *map[string]int)
- func (b *Batch) OpenWindow(buffer Buffer, enter bool, config *WindowConfig, window *Window)
- func (b *Batch) Option(name string, result interface{})
- func (b *Batch) OptionInfo(name string, opinfo *OptionInfo)
- func (b *Batch) ParseExpression(expr string, flags string, highlight bool, expression *map[string]interface{})
- func (b *Batch) Paste(data string, crlf bool, phase int, state *bool)
- func (b *Batch) Proc(pid int, process *Process)
- func (b *Batch) ProcChildren(pid int, processes *[]*Process)
- func (b *Batch) Put(lines []string, typ string, after bool, follow bool)
- func (b *Batch) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool, input *string)
- func (b *Batch) Request(procedure string, result interface{}, args ...interface{})
- func (b *Batch) RuntimeFiles(name string, all bool, files *[]string)
- func (b *Batch) RuntimePaths(paths *[]string)
- func (b *Batch) SelectPopupmenuItem(item int, insert bool, finish bool, opts map[string]interface{})
- func (b *Batch) SetBufferExtmark(buffer Buffer, nsID int, line int, col int, opts map[string]interface{}, ...)
- func (b *Batch) SetBufferKeyMap(buffer Buffer, mode string, lhs string, rhs string, opts map[string]bool)
- func (b *Batch) SetBufferLines(buffer Buffer, start int, end int, strict bool, replacement [][]byte)
- func (b *Batch) SetBufferName(buffer Buffer, name string)
- func (b *Batch) SetBufferOption(buffer Buffer, name string, value interface{})
- func (b *Batch) SetBufferText(buffer Buffer, startRow int, startCol int, endRow int, endCol int, ...)
- func (b *Batch) SetBufferToWindow(window Window, buffer Buffer)
- func (b *Batch) SetBufferVar(buffer Buffer, name string, value interface{})
- func (b *Batch) SetBufferVirtualText(buffer Buffer, nsID int, line int, chunks []VirtualTextChunk, ...)
- func (b *Batch) SetClientInfo(name string, version *ClientVersion, typ string, ...)
- func (b *Batch) SetCurrentBuffer(buffer Buffer)
- func (b *Batch) SetCurrentDirectory(dir string)
- func (b *Batch) SetCurrentLine(line []byte)
- func (b *Batch) SetCurrentTabpage(tabpage Tabpage)
- func (b *Batch) SetCurrentWindow(window Window)
- func (b *Batch) SetHighlight(nsID int, name string, val *HLAttrs)
- func (b *Batch) SetHighlightNameSpace(nsID int)
- func (b *Batch) SetKeyMap(mode string, lhs string, rhs string, opts map[string]bool)
- func (b *Batch) SetOption(name string, value interface{})
- func (b *Batch) SetPumBounds(width float64, height float64, row float64, col float64)
- func (b *Batch) SetPumHeight(height int)
- func (b *Batch) SetTabpageVar(tabpage Tabpage, name string, value interface{})
- func (b *Batch) SetUIOption(name string, value interface{})
- func (b *Batch) SetVVar(name string, value interface{})
- func (b *Batch) SetVar(name string, value interface{})
- func (b *Batch) SetWindowConfig(window Window, config *WindowConfig)
- func (b *Batch) SetWindowCursor(window Window, pos [2]int)
- func (b *Batch) SetWindowHeight(window Window, height int)
- func (b *Batch) SetWindowOption(window Window, name string, value interface{})
- func (b *Batch) SetWindowVar(window Window, name string, value interface{})
- func (b *Batch) SetWindowWidth(window Window, width int)
- func (b *Batch) StringWidth(s string, width *int)
- func (b *Batch) Subscribe(event string)
- func (b *Batch) TabpageNumber(tabpage Tabpage, number *int)
- func (b *Batch) TabpageVar(tabpage Tabpage, name string, result interface{})
- func (b *Batch) TabpageWindow(tabpage Tabpage, result *Window)
- func (b *Batch) TabpageWindows(tabpage Tabpage, windows *[]Window)
- func (b *Batch) Tabpages(tabpages *[]Tabpage)
- func (b *Batch) TryResizeUI(width int, height int)
- func (b *Batch) TryResizeUIGrid(grid int, width int, height int)
- func (b *Batch) UIs(uis *[]*UI)
- func (b *Batch) Unsubscribe(event string)
- func (b *Batch) VVar(name string, result interface{})
- func (b *Batch) Var(name string, result interface{})
- func (b *Batch) WindowBuffer(window Window, buffer *Buffer)
- func (b *Batch) WindowConfig(window Window, config *WindowConfig)
- func (b *Batch) WindowCursor(window Window, pos *[2]int)
- func (b *Batch) WindowHeight(window Window, height *int)
- func (b *Batch) WindowNumber(window Window, number *int)
- func (b *Batch) WindowOption(window Window, name string, result interface{})
- func (b *Batch) WindowPosition(window Window, pos *[2]int)
- func (b *Batch) WindowTabpage(window Window, tabpage *Tabpage)
- func (b *Batch) WindowVar(window Window, name string, result interface{})
- func (b *Batch) WindowWidth(window Window, width *int)
- func (b *Batch) Windows(windows *[]Window)
- func (b *Batch) WriteErr(str string)
- func (b *Batch) WriteOut(str string)
- func (b *Batch) WritelnErr(str string)
- type BatchError
- type Buffer
- type Channel
- type ChildProcessOption
- func ChildProcessArgs(args ...string) ChildProcessOption
- func ChildProcessCommand(command string) ChildProcessOption
- func ChildProcessContext(ctx context.Context) ChildProcessOption
- func ChildProcessDir(dir string) ChildProcessOption
- func ChildProcessEnv(env []string) ChildProcessOption
- func ChildProcessLogf(logf func(string, ...interface{})) ChildProcessOption
- func ChildProcessServe(serve bool) ChildProcessOption
- type Client
- type ClientAttributes
- type ClientMethod
- type ClientMethodNArgs
- type ClientType
- type ClientVersion
- type Command
- type CommandCompletionArgs
- type DialOption
- type EchoChunk
- type EmbedOptionsdeprecated
- type ErrorList
- type ExtMarks
- type HLAttrs
- type Mapping
- type Mode
- type Nvim
- func (v *Nvim) APIInfo() (apiInfo []interface{}, err error)
- func (v *Nvim) AddBufferHighlight(buffer Buffer, srcID int, hlGroup string, line int, startCol int, endCol int) (id int, err error)
- func (v *Nvim) AllOptionsInfo() (opinfo *OptionInfo, err error)
- func (v *Nvim) AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}) (attached bool, err error)
- func (v *Nvim) AttachUI(width int, height int, options map[string]interface{}) error
- func (v *Nvim) BufferChangedTick(buffer Buffer) (changedtick int, err error)
- func (v *Nvim) BufferCommands(buffer Buffer, opts map[string]interface{}) (map[string]*Command, error)
- func (v *Nvim) BufferExtmarkByID(buffer Buffer, nsID int, id int, opt map[string]interface{}) (pos []int, err error)
- func (v *Nvim) BufferExtmarks(buffer Buffer, nsID int, start interface{}, end interface{}, ...) (marks []ExtMarks, err error)
- func (v *Nvim) BufferKeyMap(buffer Buffer, mode string) ([]*Mapping, error)
- func (v *Nvim) BufferLineCount(buffer Buffer) (count int, err error)
- func (v *Nvim) BufferLines(buffer Buffer, start int, end int, strict bool) (lines [][]byte, err error)
- func (v *Nvim) BufferMark(buffer Buffer, name string) (pos [2]int, err error)
- func (v *Nvim) BufferName(buffer Buffer) (name string, err error)
- func (v *Nvim) BufferNumber(buffer Buffer) (number int, err error)deprecated
- func (v *Nvim) BufferOffset(buffer Buffer, index int) (offset int, err error)
- func (v *Nvim) BufferOption(buffer Buffer, name string, result interface{}) error
- func (v *Nvim) BufferVar(buffer Buffer, name string, result interface{}) error
- func (v *Nvim) Buffers() (buffers []Buffer, err error)
- func (v *Nvim) Call(fname string, result interface{}, args ...interface{}) error
- func (v *Nvim) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{}) error
- func (v *Nvim) ChannelID() int
- func (v *Nvim) ChannelInfo(channelID int) (channel *Channel, err error)
- func (v *Nvim) Channels() (channels []*Channel, err error)
- func (v *Nvim) ClearBufferHighlight(buffer Buffer, srcID int, startLine int, endLine int) errordeprecated
- func (v *Nvim) ClearBufferNamespace(buffer Buffer, nsID int, lineStart int, lineEnd int) error
- func (v *Nvim) Close() error
- func (v *Nvim) CloseWindow(window Window, force bool) error
- func (v *Nvim) ColorByName(name string) (color int, err error)
- func (v *Nvim) ColorMap() (colorMap map[string]int, err error)
- func (v *Nvim) Command(cmd string) error
- func (v *Nvim) CommandOutput(cmd string) (out string, err error)deprecated
- func (v *Nvim) Commands(opts map[string]interface{}) (commands map[string]*Command, err error)
- func (v *Nvim) Context(opts map[string][]string) (contexts map[string]interface{}, err error)
- func (v *Nvim) CreateBuffer(listed bool, scratch bool) (buffer Buffer, err error)
- func (v *Nvim) CreateNamespace(name string) (nsID int, err error)
- func (v *Nvim) CurrentBuffer() (buffer Buffer, err error)
- func (v *Nvim) CurrentLine() (line []byte, err error)
- func (v *Nvim) CurrentTabpage() (tabpage Tabpage, err error)
- func (v *Nvim) CurrentWindow() (window Window, err error)
- func (v *Nvim) DeleteBuffer(buffer Buffer, opts map[string]bool) error
- func (v *Nvim) DeleteBufferExtmark(buffer Buffer, nsID int, extmarkID int) (deleted bool, err error)
- func (v *Nvim) DeleteBufferKeyMap(buffer Buffer, mode string, lhs string) error
- func (v *Nvim) DeleteBufferVar(buffer Buffer, name string) error
- func (v *Nvim) DeleteCurrentLine() error
- func (v *Nvim) DeleteKeyMap(mode string, lhs string) error
- func (v *Nvim) DeleteTabpageVar(tabpage Tabpage, name string) error
- func (v *Nvim) DeleteVar(name string) error
- func (v *Nvim) DeleteWindowVar(window Window, name string) error
- func (v *Nvim) DetachBuffer(buffer Buffer) (detached bool, err error)
- func (v *Nvim) DetachUI() error
- func (v *Nvim) Echo(chunks []EchoChunk, history bool, opts map[string]interface{}) error
- func (v *Nvim) Eval(expr string, result interface{}) error
- func (v *Nvim) Exec(src string, output bool) (out string, err error)
- func (v *Nvim) ExecLua(code string, result interface{}, args ...interface{}) error
- func (v *Nvim) ExecuteLua(code string, result interface{}, args ...interface{}) errordeprecated
- func (v *Nvim) FeedKeys(keys string, mode string, escapeCSI bool) error
- func (v *Nvim) HLByID(id int, rgb bool) (highlight *HLAttrs, err error)
- func (v *Nvim) HLByName(name string, rgb bool) (highlight *HLAttrs, err error)
- func (v *Nvim) HLIDByName(name string) (highlightID int, err error)
- func (v *Nvim) Input(keys string) (written int, err error)
- func (v *Nvim) InputMouse(button string, action string, modifier string, grid int, row int, col int) error
- func (v *Nvim) IsBufferLoaded(buffer Buffer) (loaded bool, err error)
- func (v *Nvim) IsBufferValid(buffer Buffer) (valied bool, err error)
- func (v *Nvim) IsTabpageValid(tabpage Tabpage) (valid bool, err error)
- func (v *Nvim) IsWindowValid(window Window) (valid bool, err error)
- func (v *Nvim) KeyMap(mode string) (maps []*Mapping, err error)
- func (v *Nvim) LoadContext(dict map[string]interface{}, result interface{}) error
- func (v *Nvim) Mode() (mode *Mode, err error)
- func (v *Nvim) Namespaces() (namespaces map[string]int, err error)
- func (v *Nvim) NewBatch() *Batch
- func (v *Nvim) OpenWindow(buffer Buffer, enter bool, config *WindowConfig) (window Window, err error)
- func (v *Nvim) Option(name string, result interface{}) error
- func (v *Nvim) OptionInfo(name string) (opinfo *OptionInfo, err error)
- func (v *Nvim) ParseExpression(expr string, flags string, highlight bool) (expression map[string]interface{}, err error)
- func (v *Nvim) Paste(data string, crlf bool, phase int) (state bool, err error)
- func (v *Nvim) Proc(pid int) (process Process, err error)
- func (v *Nvim) ProcChildren(pid int) (processes []*Process, err error)
- func (v *Nvim) Put(lines []string, typ string, after bool, follow bool) error
- func (v *Nvim) RegisterHandler(method string, fn interface{}) error
- func (v *Nvim) ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool) (input string, err error)
- func (v *Nvim) Request(procedure string, result interface{}, args ...interface{}) error
- func (v *Nvim) RuntimeFiles(name string, all bool) (files []string, err error)
- func (v *Nvim) RuntimePaths() (paths []string, err error)
- func (v *Nvim) SelectPopupmenuItem(item int, insert bool, finish bool, opts map[string]interface{}) error
- func (v *Nvim) Serve() error
- func (v *Nvim) SetBufferExtmark(buffer Buffer, nsID int, line int, col int, opts map[string]interface{}) (id int, err error)
- func (v *Nvim) SetBufferKeyMap(buffer Buffer, mode string, lhs string, rhs string, opts map[string]bool) error
- func (v *Nvim) SetBufferLines(buffer Buffer, start int, end int, strict bool, replacement [][]byte) error
- func (v *Nvim) SetBufferName(buffer Buffer, name string) error
- func (v *Nvim) SetBufferOption(buffer Buffer, name string, value interface{}) error
- func (v *Nvim) SetBufferText(buffer Buffer, startRow int, startCol int, endRow int, endCol int, ...) error
- func (v *Nvim) SetBufferToWindow(window Window, buffer Buffer) error
- func (v *Nvim) SetBufferVar(buffer Buffer, name string, value interface{}) error
- func (v *Nvim) SetBufferVirtualText(buffer Buffer, nsID int, line int, chunks []VirtualTextChunk, ...) (id int, err error)
- func (v *Nvim) SetClientInfo(name string, version *ClientVersion, typ string, ...) error
- func (v *Nvim) SetCurrentBuffer(buffer Buffer) error
- func (v *Nvim) SetCurrentDirectory(dir string) error
- func (v *Nvim) SetCurrentLine(line []byte) error
- func (v *Nvim) SetCurrentTabpage(tabpage Tabpage) error
- func (v *Nvim) SetCurrentWindow(window Window) error
- func (v *Nvim) SetHighlight(nsID int, name string, val *HLAttrs) error
- func (v *Nvim) SetHighlightNameSpace(nsID int) error
- func (v *Nvim) SetKeyMap(mode string, lhs string, rhs string, opts map[string]bool) error
- func (v *Nvim) SetOption(name string, value interface{}) error
- func (v *Nvim) SetPumBounds(width float64, height float64, row float64, col float64) error
- func (v *Nvim) SetPumHeight(height int) error
- func (v *Nvim) SetTabpageVar(tabpage Tabpage, name string, value interface{}) error
- func (v *Nvim) SetUIOption(name string, value interface{}) error
- func (v *Nvim) SetVVar(name string, value interface{}) error
- func (v *Nvim) SetVar(name string, value interface{}) error
- func (v *Nvim) SetWindowConfig(window Window, config *WindowConfig) error
- func (v *Nvim) SetWindowCursor(window Window, pos [2]int) error
- func (v *Nvim) SetWindowHeight(window Window, height int) error
- func (v *Nvim) SetWindowOption(window Window, name string, value interface{}) error
- func (v *Nvim) SetWindowVar(window Window, name string, value interface{}) error
- func (v *Nvim) SetWindowWidth(window Window, width int) error
- func (v *Nvim) StringWidth(s string) (width int, err error)
- func (v *Nvim) Subscribe(event string) error
- func (v *Nvim) TabpageNumber(tabpage Tabpage) (number int, err error)
- func (v *Nvim) TabpageVar(tabpage Tabpage, name string, result interface{}) error
- func (v *Nvim) TabpageWindow(tabpage Tabpage) (Window, error)
- func (v *Nvim) TabpageWindows(tabpage Tabpage) (windows []Window, err error)
- func (v *Nvim) Tabpages() (tabpages []Tabpage, err error)
- func (v *Nvim) TryResizeUI(width int, height int) error
- func (v *Nvim) TryResizeUIGrid(grid int, width int, height int) error
- func (v *Nvim) UIs() (uis []*UI, err error)
- func (v *Nvim) Unsubscribe(event string) error
- func (v *Nvim) VVar(name string, result interface{}) error
- func (v *Nvim) Var(name string, result interface{}) error
- func (v *Nvim) WindowBuffer(window Window) (buffer Buffer, err error)
- func (v *Nvim) WindowConfig(window Window) (config *WindowConfig, err error)
- func (v *Nvim) WindowCursor(window Window) (pos [2]int, err error)
- func (v *Nvim) WindowHeight(window Window) (height int, err error)
- func (v *Nvim) WindowNumber(window Window) (number int, err error)
- func (v *Nvim) WindowOption(window Window, name string, result interface{}) error
- func (v *Nvim) WindowPosition(window Window) (pos [2]int, err error)
- func (v *Nvim) WindowTabpage(window Window) (tabpage Tabpage, err error)
- func (v *Nvim) WindowVar(window Window, name string, result interface{}) error
- func (v *Nvim) WindowWidth(window Window) (width int, err error)
- func (v *Nvim) Windows() (windows []Window, err error)
- func (v *Nvim) WriteErr(str string) error
- func (v *Nvim) WriteOut(str string) error
- func (v *Nvim) WritelnErr(str string) error
- type OptionInfo
- type Process
- type QuickfixError
- type Tabpage
- type UI
- type VirtualTextChunk
- type Window
- type WindowConfig
Examples ¶
Constants ¶
const ( // ClientAttributeKeyWebsite Website of client (for instance github repository). ClientAttributeKeyWebsite = "website" // ClientAttributeKeyLicense Informal description of the license, such as "Apache 2", "GPLv3" or "MIT". ClientAttributeKeyLicense = "license" // ClientoAttributeKeyLogo URI or path to image, preferably small logo or icon. .png or .svg format is preferred. ClientoAttributeKeyLogo = "logo" )
Variables ¶
This section is empty.
Functions ¶
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) 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 ¶
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 ¶
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 ¶
BufferKeymap gets a list of buffer-local mappings.
The mode short-name ("n", "i", "v", ...).
func (*Batch) BufferLineCount ¶
BufferLineCount returns the number of lines in the buffer.
func (*Batch) BufferLines ¶
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 ¶
BufferMark returns the (row,col) of the named mark.
func (*Batch) BufferName ¶
BufferName gets the full file name of a buffer.
func (*Batch) BufferNumber
deprecated
func (*Batch) BufferOffset ¶
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 ¶
BufferOption gets a buffer option value.
func (*Batch) ChannelInfo ¶
ChannelInfo get information about a channel.
func (*Batch) ClearBufferHighlight
deprecated
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 ¶
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 ¶
CloseWindow close a window.
This is equivalent to |:close| with count except that it takes a window id.
func (*Batch) ColorByName ¶
ColorByName returns the 24-bit RGB value of a ColorMap color name or `#rrggbb` hexadecimal string.
func (*Batch) ColorMap ¶
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) CommandOutput
deprecated
func (*Batch) Commands ¶
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
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 ¶
CreateBuffer creates a new, empty, unnamed buffer.
func (*Batch) CreateNamespace ¶
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 ¶
CurrentBuffer returns the current buffer.
func (*Batch) CurrentLine ¶
CurrentLine gets the current line in the current buffer.
func (*Batch) CurrentTabpage ¶
CurrentTabpage returns the current tabpage.
func (*Batch) CurrentWindow ¶
CurrentWindow returns the current window.
func (*Batch) DeleteBuffer ¶ added in v1.1.4
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
DeleteBufferExtmark removes an extmark.
func (*Batch) DeleteBufferKeyMap ¶ added in v1.0.1
DeleteBufferKeyMap unmaps a buffer-local mapping for the given mode.
See:
:help nvim_del_keymap()
func (*Batch) DeleteBufferVar ¶
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
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 ¶
DeleteTabpageVar removes a tab-scoped (t:) variable.
func (*Batch) DeleteWindowVar ¶
DeleteWindowVar removes a window-scoped (w:) variable.
func (*Batch) DetachBuffer ¶
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) Echo ¶ added in v1.1.6
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 ¶
Eval evaluates the expression expr using the Vim internal expression evaluator.
:help expression
func (*Batch) Exec ¶ added in v1.0.2
Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.
func (*Batch) ExecuteLua
deprecated
func (*Batch) FeedKeys ¶
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) HLIDByName ¶ added in v1.0.2
HLIDByName gets a highlight group by name.
func (*Batch) Input ¶
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 ¶
IsBufferLoaded Checks if a buffer is valid and loaded. See api-buffer for more info about unloaded buffers.
func (*Batch) IsBufferValid ¶
IsBufferValid returns true if the buffer is valid.
func (*Batch) IsTabpageValid ¶
IsTabpageValid checks if a tab page is valid.
func (*Batch) IsWindowValid ¶
IsWindowValid returns true if the window is valid.
func (*Batch) KeyMap ¶
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
LoadContext sets the current editor state from the given context map.
func (*Batch) Namespaces ¶
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) 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
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) ProcChildren ¶
ProcChildren gets the immediate children of process `pid`.
func (*Batch) Put ¶ added in v1.0.2
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 ¶
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) RuntimeFiles ¶ added in v1.1.1
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 ¶
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 ¶
SetBufferName sets the full file name of a buffer. BufFilePre/BufFilePost are triggered.
func (*Batch) SetBufferOption ¶
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 ¶
SetBufferToWindow sets the current buffer in a window, without side-effects.
func (*Batch) SetBufferVar ¶
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 ¶
SetCurrentBuffer sets the current buffer.
func (*Batch) SetCurrentDirectory ¶
SetCurrentDirectory changes the Vim working directory.
func (*Batch) SetCurrentLine ¶
SetCurrentLine sets the current line in the current buffer.
func (*Batch) SetCurrentTabpage ¶
SetCurrentTabpage sets the current tabpage.
func (*Batch) SetCurrentWindow ¶
SetCurrentWindow sets the current window.
func (*Batch) SetHighlight ¶ added in v1.1.4
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
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
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) SetPumBounds ¶ added in v1.1.4
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
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 ¶
SetTabpageVar sets a tab-scoped (t:) variable.
func (*Batch) SetUIOption ¶
SetUIOption sets a UI option.
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 ¶
SetWindowCursor sets the cursor position in the window to the given position.
func (*Batch) SetWindowHeight ¶
SetWindowHeight sets the window height.
func (*Batch) SetWindowOption ¶
SetWindowOption sets a window option.
func (*Batch) SetWindowVar ¶
SetWindowVar sets a window-scoped (w:) variable.
func (*Batch) SetWindowWidth ¶
SetWindowWidth sets the window width.
func (*Batch) StringWidth ¶
StringWidth returns the number of display cells the string occupies. Tab is counted as one cell.
func (*Batch) TabpageNumber ¶
TabpageNumber gets the tabpage number from the tabpage handle.
func (*Batch) TabpageVar ¶
TabpageVar gets a tab-scoped (t:) variable.
func (*Batch) TabpageWindow ¶
TabpageWindow gets the current window in a tab page.
func (*Batch) TabpageWindows ¶
TabpageWindows returns the windows in a tabpage.
func (*Batch) TryResizeUI ¶
TryResizeUI notifies Nvim that the client window has resized. If possible, Nvim will send a redraw request to resize.
func (*Batch) TryResizeUIGrid ¶
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) Unsubscribe ¶
Unsubscribe unsubscribes to a Nvim event.
func (*Batch) WindowBuffer ¶
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 ¶
WindowCursor returns the cursor position in the window.
func (*Batch) WindowHeight ¶
WindowHeight returns the window height.
func (*Batch) WindowNumber ¶
WindowNumber gets the window number from the window handle.
func (*Batch) WindowOption ¶
WindowOption gets a window option.
func (*Batch) WindowPosition ¶
WindowPosition gets the window position in display cells. First position is zero.
func (*Batch) WindowTabpage ¶
WindowTabpage gets the tab page that contains the window.
func (*Batch) WindowWidth ¶
WindowWidth returns the window width.
func (*Batch) WriteErr ¶
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 ¶
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 ¶
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 ¶
MarshalMsgPack implements msgpack.Marshaler.
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 ¶
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 ¶
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 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 ¶
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) 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 ¶
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 ¶
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 ¶
BufferKeymap gets a list of buffer-local mappings.
The mode short-name ("n", "i", "v", ...).
func (*Nvim) BufferLineCount ¶
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 ¶
BufferMark returns the (row,col) of the named mark.
func (*Nvim) BufferName ¶
BufferName gets the full file name of a buffer.
func (*Nvim) BufferNumber
deprecated
func (*Nvim) BufferOffset ¶
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 ¶
BufferOption gets a buffer option value.
func (*Nvim) CallDict ¶
func (v *Nvim) CallDict(dict []interface{}, fname string, result interface{}, args ...interface{}) error
CallDict calls a vimscript Dictionary function.
func (*Nvim) ChannelInfo ¶
ChannelInfo get information about a channel.
func (*Nvim) ClearBufferHighlight
deprecated
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 ¶
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) CloseWindow ¶
CloseWindow close a window.
This is equivalent to |:close| with count except that it takes a window id.
func (*Nvim) ColorByName ¶
ColorByName returns the 24-bit RGB value of a ColorMap color name or `#rrggbb` hexadecimal string.
func (*Nvim) ColorMap ¶
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) CommandOutput
deprecated
func (*Nvim) Commands ¶
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
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 ¶
CreateBuffer creates a new, empty, unnamed buffer.
func (*Nvim) CreateNamespace ¶
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 ¶
CurrentBuffer returns the current buffer.
func (*Nvim) CurrentLine ¶
CurrentLine gets the current line in the current buffer.
func (*Nvim) CurrentTabpage ¶
CurrentTabpage returns the current tabpage.
func (*Nvim) CurrentWindow ¶
CurrentWindow returns the current window.
func (*Nvim) DeleteBuffer ¶ added in v1.1.4
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
DeleteBufferKeyMap unmaps a buffer-local mapping for the given mode.
See:
:help nvim_del_keymap()
func (*Nvim) DeleteBufferVar ¶
DeleteBufferVar removes a buffer-scoped (b:) variable.
func (*Nvim) DeleteCurrentLine ¶
DeleteCurrentLine deletes the current line in the current buffer.
func (*Nvim) DeleteKeyMap ¶ added in v1.0.1
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 ¶
DeleteTabpageVar removes a tab-scoped (t:) variable.
func (*Nvim) DeleteWindowVar ¶
DeleteWindowVar removes a window-scoped (w:) variable.
func (*Nvim) DetachBuffer ¶
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) Echo ¶ added in v1.1.6
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 ¶
Eval evaluates the expression expr using the Vim internal expression evaluator.
:help expression
func (*Nvim) Exec ¶ added in v1.0.2
Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.
func (*Nvim) ExecuteLua
deprecated
func (*Nvim) FeedKeys ¶
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) HLIDByName ¶ added in v1.0.2
HLIDByName gets a highlight group by name.
func (*Nvim) Input ¶
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 ¶
IsBufferLoaded Checks if a buffer is valid and loaded. See api-buffer for more info about unloaded buffers.
func (*Nvim) IsBufferValid ¶
IsBufferValid returns true if the buffer is valid.
func (*Nvim) IsTabpageValid ¶
IsTabpageValid checks if a tab page is valid.
func (*Nvim) IsWindowValid ¶
IsWindowValid returns true if the window is valid.
func (*Nvim) KeyMap ¶
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
LoadContext sets the current editor state from the given context map.
func (*Nvim) Namespaces ¶
Namespaces gets existing named namespaces.
The return dict that maps from names to namespace ids.
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) 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
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) ProcChildren ¶
ProcChildren gets the immediate children of process `pid`.
func (*Nvim) Put ¶ added in v1.0.2
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 ¶
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) RuntimeFiles ¶ added in v1.1.1
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 ¶
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 ¶
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 ¶
SetBufferName sets the full file name of a buffer. BufFilePre/BufFilePost are triggered.
func (*Nvim) SetBufferOption ¶
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 ¶
SetBufferToWindow sets the current buffer in a window, without side-effects.
func (*Nvim) SetBufferVar ¶
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 ¶
SetCurrentBuffer sets the current buffer.
func (*Nvim) SetCurrentDirectory ¶
SetCurrentDirectory changes the Vim working directory.
func (*Nvim) SetCurrentLine ¶
SetCurrentLine sets the current line in the current buffer.
func (*Nvim) SetCurrentTabpage ¶
SetCurrentTabpage sets the current tabpage.
func (*Nvim) SetCurrentWindow ¶
SetCurrentWindow sets the current window.
func (*Nvim) SetHighlight ¶ added in v1.1.4
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
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
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) SetPumBounds ¶ added in v1.1.4
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
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 ¶
SetTabpageVar sets a tab-scoped (t:) variable.
func (*Nvim) SetUIOption ¶
SetUIOption sets a UI option.
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 ¶
SetWindowCursor sets the cursor position in the window to the given position.
func (*Nvim) SetWindowHeight ¶
SetWindowHeight sets the window height.
func (*Nvim) SetWindowOption ¶
SetWindowOption sets a window option.
func (*Nvim) SetWindowVar ¶
SetWindowVar sets a window-scoped (w:) variable.
func (*Nvim) SetWindowWidth ¶
SetWindowWidth sets the window width.
func (*Nvim) StringWidth ¶
StringWidth returns the number of display cells the string occupies. Tab is counted as one cell.
func (*Nvim) TabpageNumber ¶
TabpageNumber gets the tabpage number from the tabpage handle.
func (*Nvim) TabpageVar ¶
TabpageVar gets a tab-scoped (t:) variable.
func (*Nvim) TabpageWindow ¶
TabpageWindow gets the current window in a tab page.
func (*Nvim) TabpageWindows ¶
TabpageWindows returns the windows in a tabpage.
func (*Nvim) TryResizeUI ¶
TryResizeUI notifies Nvim that the client window has resized. If possible, Nvim will send a redraw request to resize.
func (*Nvim) TryResizeUIGrid ¶
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) Unsubscribe ¶
Unsubscribe unsubscribes to a Nvim event.
func (*Nvim) WindowBuffer ¶
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 ¶
WindowCursor returns the cursor position in the window.
func (*Nvim) WindowHeight ¶
WindowHeight returns the window height.
func (*Nvim) WindowNumber ¶
WindowNumber gets the window number from the window handle.
func (*Nvim) WindowOption ¶
WindowOption gets a window option.
func (*Nvim) WindowPosition ¶
WindowPosition gets the window position in display cells. First position is zero.
func (*Nvim) WindowTabpage ¶
WindowTabpage gets the tab page that contains the window.
func (*Nvim) WindowWidth ¶
WindowWidth returns the window width.
func (*Nvim) WriteErr ¶
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 ¶
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 ¶
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 ¶
MarshalMsgPack implements msgpack.Marshaler.
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 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 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 ¶
MarshalMsgPack implements msgpack.Marshaler.
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`.