Buffer Queries
getActiveBufferId
Get the buffer ID of the focused editor pane.number
The active buffer ID, or 0 if no buffer is active (rare edge case)
getBufferPath
Get the absolute file path for a buffer.number
required
Target buffer ID
string
Absolute file path, or empty string for unsaved buffers or virtual buffers
getBufferLength
Get the total byte length of a buffer’s content.number
required
Target buffer ID
number
Buffer length in bytes, or 0 if buffer doesn’t exist
isBufferModified
Check if a buffer has been modified since last save.number
required
Target buffer ID
boolean
true if buffer has unsaved changes, false otherwise. Virtual buffers are never considered modified.getBufferInfo
Get full information about a buffer.number
required
Buffer ID to query
BufferInfo | null
Buffer information object, or
null if buffer doesn’t existlistBuffers
List all open buffers.BufferInfo[]
Array of all open buffers
getBufferText
Get text from a buffer range.number
required
Buffer ID
number
required
Start byte offset
number
required
End byte offset
Promise<string>
Text content from the specified range
findBufferByPath
Find a buffer ID by its file path.string
required
File path to search for
number
Buffer ID if found, or 0 if not found
Cursor Operations
getCursorPosition
Get the byte offset of the primary cursor.number
Byte offset of cursor, or 0 if no cursor. For multi-cursor, use
getAllCursors.This returns a byte offset, not a character index. Use this with
insertText and deleteRange.getCursorLine
Get the line number of the primary cursor (1-indexed).number
Line number starting at 1. Returns 1 if no cursor exists.
getPrimaryCursor
Get primary cursor with selection info.CursorInfo | null
Cursor information including position and selection, or
null if no cursorgetAllCursors
Get all cursors (for multi-cursor support).CursorInfo[]
Array of all cursors with position and selection info
getAllCursorPositions
Get byte offsets of all cursors.number[]
Array of cursor positions. Empty if no cursors. Primary cursor is typically first.
setBufferCursor
Set cursor position in a buffer (also scrolls viewport to show cursor).number
required
ID of the buffer
number
required
Byte offset position for the cursor
boolean
true if successfulBuffer Mutations
insertText
Insert text at a byte position in a buffer.number
required
Target buffer ID
number
required
Byte offset where text will be inserted (must be at char boundary)
string
required
UTF-8 text to insert
boolean
true if command was sent successfully. Operation is asynchronous.insertAtCursor
Insert text at the current cursor position in the active buffer.string
required
The text to insert
boolean
true if successfuldeleteRange
Delete a byte range from a buffer.number
required
Target buffer ID
number
required
Start byte offset (inclusive)
number
required
End byte offset (exclusive)
boolean
true if command was sent successfully. Operation is asynchronous.Buffer Display
showBuffer
Switch the current split to display a buffer.number
required
ID of the buffer to show
boolean
true if successfulcloseBuffer
Close a buffer and remove it from all splits.number
required
ID of the buffer to close
boolean
true if successfulopenFile
Open a file in the editor, optionally at a specific location.string
required
File path to open
number
required
Line number to jump to (0 for no jump)
number
required
Column number to jump to (0 for no jump)
boolean
true if successfulopenFileInSplit
Open a file in a specific split pane.number
required
The split ID to open the file in
string
required
File path to open
number
required
Line number to jump to (0 for no jump)
number
required
Column number to jump to (0 for no jump)
boolean
true if successfulConfiguration
getConfig
Get the current editor configuration.unknown
Merged configuration (user config file + compiled-in defaults). This is the runtime config that the editor is actually using.
getUserConfig
Get the user’s configuration (only explicitly set values).unknown
Configuration from the user’s config file only. Fields not present here are using default values.
getConfigDir
Get the absolute path to the user config directory.string
Absolute path to config directory (e.g.,
~/.config/fresh/ on Linux)reloadConfig
Reload configuration from file.Diagnostics
getAllDiagnostics
Get all LSP diagnostics across all files.TsDiagnostic[]
Array of all LSP diagnostics
Actions
executeAction
Execute a built-in editor action by name.string
required
Action name (e.g., “move_word_right”, “move_line_end”)
boolean
true if successfulexecuteActions
Execute multiple actions in sequence, each with an optional repeat count.ActionSpecJs[]
required
Array of action specifications
boolean
true if successfulClipboard
setClipboard
Copy text to the system clipboard.string
required
Text to copy to clipboard