TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sxyazi/yazi/llms.txt
Use this file to discover all available pages before exploring further.
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.
Async function to execute
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 to execute in sync context
Callable function that returns results from sync execution
ya.join(fn1, fn2, ...)
Wait for multiple async functions to complete.
Async functions to join
Combined results from all functions
ya.sleep(ms)
Sleep for specified milliseconds (async).
Milliseconds to sleep
Channels
ya.chan(type, buffer?)
Create a channel for async communication.
Channel type:
"mpsc" or "oneshot"Buffer size for mpsc (omit for unbounded)
Channel sender and receiver
Actions & Events
ya.emit(name, args)
Emit a custom action.
Action name
Action arguments
ya.manager_emit(name, args)
Emit an action to the file manager.
Manager action name (e.g., “open”, “cd”, “select”)
Action arguments
Logging
ya.dbg(...)
Log debug message.
Values to log
ya.err(...)
Log error message.
Values to log
Preview Functions
ya.preview_code(options)
Preview a code file with syntax highlighting.
Preview options
Preview area
File URL
Number of lines to skip
ya.preview_widget(job, widget)
Set preview widget.
Preview job
Widget or list of renderable elements
Spotlights
ya.spot_table(name, items)
Create a spotlight table.
Spotlight name
Table items
ya.spot_widgets(name, widgets)
Create a spotlight with custom widgets.
Spotlight name
List of renderable widgets
User Interaction
ya.input(options)
Show an input prompt.
Input options
Prompt title
Default value
Cursor position
{x, y} or ui.PosEmit events in real-time as user types
User input, or nil if cancelled
ya.confirm(options)
Show a confirmation dialog.
Confirmation options
Dialog title
Dialog body text
Dialog position
True if confirmed, false if cancelled
ya.notify(options)
Show a notification.
Notification options
Notification title
Notification body
Level:
"info", "warn", "error" (default: info)Auto-dismiss timeout in seconds
Caching
ya.file_cache(job)
Access file preview cache.
Preview job
Cached data, or nil if not cached
Utilities
ya.id(type)
Generate a unique ID.
ID type:
"app" or "ft" (file ticket)Unique identifier
ya.drop(userdata)
Drop/close a userdata handle (file descriptor, process handle, etc.).
Handle to drop
ya.quote(str)
Shell-quote a string.
String to quote
Shell-quoted string
ya.clipboard(text?)
Get or set clipboard contents.
Text to set (omit to get)
Clipboard text (when getting), or nil
ya.hash(text)
Compute hash of a string.
Text to hash
Hash value
ya.time()
Get current timestamp.
Unix timestamp in seconds
System Info
ya.user_name(uid?)
Get username from UID.
User ID (omit for current user)
Username, or nil if not found
ya.group_name(gid?)
Get group name from GID.
Group ID (omit for current user)
Group name, or nil if not found
ya.uid()
Get current user ID.
User ID
ya.gid()
Get current group ID.
Group ID
ya.host_name()
Get hostname.
Hostname, or nil
ya.target_os()
Get target OS name.
OS name:
"linux", "macos", "windows", etc.ya.target_family()
Get target OS family.
OS family:
"unix" or "windows"Process Info
ya.proc_info(pid?)
Get process information.
Process ID (omit for current process)
Process info table, or nil
Image Operations
ya.image_info(url)
Get image metadata.
Image file URL
Image info, or (nil, error)
ya.image_show(url, rect)
Display an image.
Image URL
Display area
Actual display area, or (nil, error)
ya.image_precache(src, dist)
Pre-cache an image.
Source image URL
Destination cache path (must be local)
Success boolean, or (false, error)
JSON
ya.json_encode(value)
Encode Lua value as JSON.
Value to encode
JSON string
ya.json_decode(json)
Decode JSON string.
JSON string
Decoded Lua value
Which-Key
ya.which(key?)
Show or hide which-key interface.
Key to show candidates for (omit to hide)