Skip to main content
The ya namespace provides core Yazi functionality including async operations, logging, UI helpers, and system utilities.

Async Operations

ya.async(fn)

Execute a function asynchronously in the background.
function
required
Async function to execute
Handle
Handle to the async task
Introduced in v25.12.29. See #3422.

ya.sync(fn)

Create a sync block that executes in the main thread with plugin context access.
function
required
Function to execute in sync context
function
Callable function that returns results from sync execution

ya.join(fn1, fn2, ...)

Wait for multiple async functions to complete.
function
required
Async functions to join
...
Combined results from all functions

ya.sleep(ms)

Sleep for specified milliseconds (async).
number
required
Milliseconds to sleep

Channels

ya.chan(type, buffer?)

Create a channel for async communication.
string
required
Channel type: "mpsc" or "oneshot"
number
Buffer size for mpsc (omit for unbounded)
Sender, Receiver
Channel sender and receiver

Actions & Events

ya.emit(name, args)

Emit a custom action.
string
required
Action name
table
required
Action arguments

ya.manager_emit(name, args)

Emit an action to the file manager.
string
required
Manager action name (e.g., “open”, “cd”, “select”)
table
required
Action arguments

Logging

ya.dbg(...)

Log debug message.
any
required
Values to log

ya.err(...)

Log error message.
any
required
Values to log

Preview Functions

ya.preview_code(options)

Preview a code file with syntax highlighting.
table
required
Preview options
Rect
required
Preview area
Url
required
File URL
number
required
Number of lines to skip

ya.preview_widget(job, widget)

Set preview widget.
table
required
Preview job
table|Renderable
required
Widget or list of renderable elements

Spotlights

ya.spot_table(name, items)

Create a spotlight table.
string
required
Spotlight name
table
required
Table items

ya.spot_widgets(name, widgets)

Create a spotlight with custom widgets.
string
required
Spotlight name
table
required
List of renderable widgets

User Interaction

ya.input(options)

Show an input prompt.
table
required
Input options
string
required
Prompt title
string
Default value
table
Cursor position {x, y} or ui.Pos
bool
Emit events in real-time as user types
string|nil
User input, or nil if cancelled

ya.confirm(options)

Show a confirmation dialog.
table
required
Confirmation options
string
required
Dialog title
string
required
Dialog body text
table
Dialog position
bool
True if confirmed, false if cancelled

ya.notify(options)

Show a notification.
table
required
Notification options
string
required
Notification title
string
required
Notification body
string
Level: "info", "warn", "error" (default: info)
number
Auto-dismiss timeout in seconds

Caching

ya.file_cache(job)

Access file preview cache.
table
required
Preview job
string|nil
Cached data, or nil if not cached

Utilities

ya.id(type)

Generate a unique ID.
string
required
ID type: "app" or "ft" (file ticket)
Id
Unique identifier

ya.drop(userdata)

Drop/close a userdata handle (file descriptor, process handle, etc.).
userdata
required
Handle to drop

ya.quote(str)

Shell-quote a string.
string
required
String to quote
string
Shell-quoted string

ya.clipboard(text?)

Get or set clipboard contents.
string
Text to set (omit to get)
string|nil
Clipboard text (when getting), or nil

ya.hash(text)

Compute hash of a string.
string
required
Text to hash
number
Hash value

ya.time()

Get current timestamp.
number
Unix timestamp in seconds

System Info

ya.user_name(uid?)

Get username from UID.
number
User ID (omit for current user)
string|nil
Username, or nil if not found

ya.group_name(gid?)

Get group name from GID.
number
Group ID (omit for current user)
string|nil
Group name, or nil if not found

ya.uid()

Get current user ID.
number
User ID

ya.gid()

Get current group ID.
number
Group ID

ya.host_name()

Get hostname.
string|nil
Hostname, or nil

ya.target_os()

Get target OS name.
string
OS name: "linux", "macos", "windows", etc.

ya.target_family()

Get target OS family.
string
OS family: "unix" or "windows"

Process Info

ya.proc_info(pid?)

Get process information.
number
Process ID (omit for current process)
table|nil
Process info table, or nil

Image Operations

ya.image_info(url)

Get image metadata.
Url
required
Image file URL
table|nil, Error
Image info, or (nil, error)

ya.image_show(url, rect)

Display an image.
Url
required
Image URL
Rect
required
Display area
Rect|nil, Error
Actual display area, or (nil, error)

ya.image_precache(src, dist)

Pre-cache an image.
Url
required
Source image URL
Url
required
Destination cache path (must be local)
bool, Error|nil
Success boolean, or (false, error)

JSON

ya.json_encode(value)

Encode Lua value as JSON.
any
required
Value to encode
string
JSON string

ya.json_decode(json)

Decode JSON string.
string
required
JSON string
any
Decoded Lua value

Which-Key

ya.which(key?)

Show or hide which-key interface.
string
Key to show candidates for (omit to hide)