You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ /sbin/yazi --debug
Yazi
Version: 0.4.2 (Arch Linux 2025-01-12)
Debug :false
Triple : x86_64-unknown-linux-gnu (linux-x86_64)
Rustc : 1.84.0 (9fc6b431 2025-01-07)
Ya
Version: 0.4.2 (Arch Linux 2025-01-12)
Emulator
Brand.from_env : Some(Kitty)
Emulator.detect : Emulator { kind: Left(Kitty), light: false, cell_size: Some((14,29)) }
Emulator.detect_full: Ok(Emulator { kind: Left(Kitty), light: false, cell_size: Some((14,29)) })
Adapter
Adapter.matches: Kgp
Desktop
XDG_SESSION_TYPE : Some("x11")
WAYLAND_DISPLAY : None
DISPLAY : Some(":0")
SWAYSOCK : None
HYPRLAND_INSTANCE_SIGNATURE: None
WAYFIRE_SOCKET : None
SSH
shared.in_ssh_connection: false
WSL
WSL: false
NVIM
NVIM :false
Neovim version: 0.10.4
Variables
SHELL : Some("/usr/bin/zsh")
EDITOR : Some("nvim")
VISUAL : Some("nvim")
YAZI_FILE_ONE : None
YAZI_CONFIG_HOME: None
YAZI_ZOXIDE_OPTS: None
FZF_DEFAULT_OPTS: Some("\n--reverse --ansi --no-multi\n--bind=ctrl-u:up,ctrl-e:down,ctrl-n:backward-char,ctrl-i:forward-char,ctrl-b:backward-word,ctrl-h:forward-word\n--border --margin=1,0\n")
Text Opener
default : Some(Opener { run: "nvim \"$@\"", block: true, orphan: false, desc: "nvim", for_: None, spread: true })
block-create: Some(Opener { run: "nvim \"$@\"", block: true, orphan: false, desc: "nvim", for_: None, spread: true })
block-rename: Some(Opener { run: "nvim \"$@\"", block: true, orphan: false, desc: "nvim", for_: None, spread: true })
Multiplexers
TMUX : 0
tmux version : tmux 3.5a
tmux build flags : enable-sixel=Unknown
ZELLIJ_SESSION_NAME: None
Zellij version : No such file or directory (os error 2)
Dependencies
file : 5.46
ueberzugpp : No such file or directory (os error 2)
ffmpeg/ffprobe: 7.1 / 7.1
pdftoppm : No such file or directory (os error 2)
magick : 7.1.1-43
fzf : 0.57.0
fd/fdfind : No such file or directory (os error 2) / No such file or directory (os error 2)
rg : 14.1.1
chafa : No such file or directory (os error 2)
zoxide : 0.9.6
7z/7zz : No such file or directory (os error 2) / No such file or directory (os error 2)
jq : No such file or directory (os error 2)
Clipboard
wl-copy/paste: No such file or directory (os error 2) / No such file or directory (os error 2)
xclip : 0.13
xsel : 1.2.1
Please describe the problem you're trying to solve
I'm trying to develop a micro plugin for Yazi that tracks repeated key presses and temporarily blocks movement after 5 rapid presses of j or k. However, I encountered an issue where the plugin cannot persist state variables such as key counts or blocked state.
Expected Behavior:
The plugin should increment a counter each time j or k is pressed.
After 5 presses, the corresponding key should be blocked for 2 seconds.
Pressing <Esc> should reset the counter and unblock the keys immediately.
Problem:
Yazi does not seem to support persistent state storage for micro plugins.
Using ya.var() or ps.pub()/ps.sub() results in errors like attempt to call a nil value.
There appears to be no built-in way to maintain a counter across function calls.
Question:
Is there any recommended way in Yazi to store and persist state across function executions within a micro plugin?
Would you be willing to contribute this feature?
Yes, I'll give it a shot
Describe the solution you'd like
I would like a way to persist state within a Yazi micro plugin, such as maintaining a counter for key presses and a flag for blocking input. Ideally, Yazi should provide a mechanism like:
A Built-in State Management API
A function like ya.state("key", value) to store and retrieve values across plugin executions.
This would allow plugins to track things like key press counts or timers without resetting on each function call.
Support for Temporary Variables
A way to declare temporary variables within the plugin’s runtime that persist across calls.
For example, ya.session_var("key", value) for short-lived states that reset when Yazi restarts.
Built-in Event System Enhancements
A more robust event system (ps.pub() / ps.sub()) that allows micro plugins to listen for state changes and react accordingly.
Currently, ps.pub() and ps.sub() seem to be unavailable in micro plugins.
With these features, I could store the key press count and blocked state reliably, allowing for smoother implementation of my "Cowboy" plugin that prevents spamming movement keys.
yazi --debug
outputPlease describe the problem you're trying to solve
I'm trying to develop a micro plugin for Yazi that tracks repeated key presses and temporarily blocks movement after 5 rapid presses of
j
ork
. However, I encountered an issue where the plugin cannot persist state variables such as key counts or blocked state.Expected Behavior:
j
ork
is pressed.<Esc>
should reset the counter and unblock the keys immediately.Problem:
ya.var()
orps.pub()/ps.sub()
results in errors likeattempt to call a nil value
.Question:
Is there any recommended way in Yazi to store and persist state across function executions within a micro plugin?
Would you be willing to contribute this feature?
Describe the solution you'd like
I would like a way to persist state within a Yazi micro plugin, such as maintaining a counter for key presses and a flag for blocking input. Ideally, Yazi should provide a mechanism like:
A Built-in State Management API
ya.state("key", value)
to store and retrieve values across plugin executions.Support for Temporary Variables
ya.session_var("key", value)
for short-lived states that reset when Yazi restarts.Built-in Event System Enhancements
ps.pub()
/ps.sub()
) that allows micro plugins to listen for state changes and react accordingly.ps.pub()
andps.sub()
seem to be unavailable in micro plugins.With these features, I could store the key press count and blocked state reliably, allowing for smoother implementation of my "Cowboy" plugin that prevents spamming movement keys.
Additional context
I implemented this logic in nvim:
Checklist
The text was updated successfully, but these errors were encountered: