Skip to main content
Virtual buffers are special buffers created by plugins to display structured data like search results, diagnostics, git logs, or file explorers. Unlike regular buffers, they’re typically read-only and contain metadata (text properties) that plugins can query.

Creating Virtual Buffers

createVirtualBufferInSplit

Create a virtual buffer in a new split below the current pane.
CreateVirtualBufferOptions
required
Buffer configuration object
Promise<CreateVirtualBufferResult>
Result containing buffer_id and optional split_id
CreateVirtualBufferOptions:
TextPropertyEntry:
The panel_id enables idempotent updates: if a panel with that ID exists, its content is replaced instead of creating a new split. Define the mode with defineMode first.
Example:

createVirtualBufferInExistingSplit

Create a virtual buffer in an existing split.
CreateVirtualBufferInExistingSplitOptions
required
Configuration for the virtual buffer
Promise<number>
The created buffer ID
CreateVirtualBufferInExistingSplitOptions:
Example:

createVirtualBuffer

Create a virtual buffer in the current split as a new tab.
CreateVirtualBufferInCurrentSplitOptions
required
Configuration for the virtual buffer
Promise<number>
The created buffer ID
CreateVirtualBufferInCurrentSplitOptions:
Example:

Managing Virtual Buffers

setVirtualBufferContent

Set the content of a virtual buffer with text properties.
number
required
ID of the virtual buffer
TextPropertyEntry[]
required
Array of text entries with properties
boolean
true if content was set successfully
Example:

getTextPropertiesAtCursor

Get text properties at the cursor position in a buffer.
number
required
ID of the buffer to query
Record<string, unknown>[]
Array of property objects at cursor position
Example:

Modes and Keybindings

defineMode

Define a buffer mode with keybindings.
string
required
Mode name (e.g., “diagnostics-list”)
string
required
Parent mode name for inheritance (e.g., “special”), or null
[string, string][]
required
Array of [key_string, command_name] pairs
boolean
required
Whether buffers in this mode are read-only
boolean
true if mode was defined successfully
Example:

Split Management

getActiveSplitId

Get the ID of the focused split pane.
number
Active split ID

focusSplit

Focus a specific split.
number
required
ID of the split to focus
boolean
true if successful

setSplitBuffer

Set the buffer displayed in a specific split.
number
required
ID of the split
number
required
ID of the buffer to display
boolean
true if successful

closeSplit

Close a split (if not the last one).
number
required
ID of the split to close
boolean
true if successful

setSplitRatio

Set the ratio of a split container.
number
required
ID of the split
number
required
Ratio between 0.0 and 1.0 (0.5 = equal split)
boolean
true if successful

distributeSplitsEvenly

Distribute all visible splits evenly.
boolean
true if successful
This adjusts the ratios of all container splits so each leaf split gets equal space.

Complete Example: Search Results Panel