Feature request: Single-key sudo mode toggle
yazi --debug output
Yazi
Version : 26.5.6 (aa52643 2026-05-05)
Debug : false
Triple : x86_64-unknown-linux-gnu (linux-x86_64)
Rustc : 1.95.0 (59807616 2026-04-14)
Backtrace: None
Ya
Version: 26.5.6 (aa52643 2026-05-05)
Config
Init : /home/nio/.config/yazi/init.lua (No such file or directory (os error 2))
Yazi : /home/nio/.config/yazi/yazi.toml (No such file or directory (os error 2))
Keymap : /home/nio/.config/yazi/keymap.toml (No such file or directory (os error 2))
Theme : /home/nio/.config/yazi/theme.toml (No such file or directory (os error 2))
VFS : /home/nio/.config/yazi/vfs.toml (No such file or directory (os error 2))
Package : /home/nio/.config/yazi/package.toml (No such file or directory (os error 2))
Dark/light flavor: ArcSwapAny("") / ArcSwapAny("")
Emulator
TERM : Some("xterm-256color")
TERM_PROGRAM : None
TERM_PROGRAM_VERSION: None
Brand.from_env : None
Emulator.detect : Emulator { kind: Right(Unknown { kgp: false, sixel: true }), version: "", light: false, csi_16t: (10, 20), force_16t: true }
Adapter
Adapter.matches : Sixel
Dimension.available: Dimension { rows: 50, columns: 210, width: 0, height: 0 }
Desktop
XDG_SESSION_TYPE : None
WAYLAND_DISPLAY : Some("wayland-0")
DISPLAY : Some(":0")
SWAYSOCK : None
HYPRLAND_INSTANCE_SIGNATURE: None
WAYFIRE_SOCKET : None
SSH
shared.in_ssh_connection: false
WSL
WSL: true
Variables
SHELL : Some("/bin/bash")
EDITOR : Some("micro")
VISUAL : None
YAZI_FILE_ONE : None
YAZI_CONFIG_HOME : None
YAZI_ZOXIDE_OPTS : None
SSH_AUTH_SOCK : None
FZF_DEFAULT_OPTS : Some("--exact --color=fg+:red")
FZF_DEFAULT_COMMAND: None
Text Opener
default : Some(OpenerRule { id: Id(3), run: NonEmptyString("${EDITOR:-vi} %s"), block: true, orphan: false, desc: "$EDITOR", for: Unix, spread: true })
block-create: Some(OpenerRule { id: Id(3), run: NonEmptyString("${EDITOR:-vi} %s"), block: true, orphan: false, desc: "$EDITOR", for: Unix, spread: true })
block-rename: Some(OpenerRule { id: Id(3), run: NonEmptyString("${EDITOR:-vi} %s"), block: true, orphan: false, desc: "$EDITOR", for: Unix, spread: true })
Multiplexers
TMUX : false
tmux version : tmux 3.5a
tmux build flags : enable-sixel=Unknown
ZELLIJ_SESSION_NAME: None
Zellij version : 0.42.1
Dependencies
file : 5.46
ueberzugpp : No such file or directory (os error 2)
ffmpeg/ffprobe: 7.1.4-0 / 7.1.4-0
pdftoppm : 25.03.0
magick : 7.1.1-43
fzf : 0.72.0
fd/fdfind : No such file or directory (os error 2) / 10.2.0
rg : 14.1.1
chafa : 1.19.0
zoxide : 0.9.7
7zz/7z : No such file or directory (os error 2) / 25.01
resvg : No such file or directory (os error 2)
jq : 1.7
Clipboard
wl-copy/paste: No such file or directory (os error 2) / No such file or directory (os error 2)
xclip : No such file or directory (os error 2)
xsel : 1.2.1
Routine
`file -bL --mime-type`: text/plainPlease describe the problem you're trying to solve
Hi, Currently, sudo.yazi requires separate key bindings for every sudo operation:
on = ["R", "p", "p"] # sudo paste
on = ["R", "P"] # sudo paste --force
on = ["R", "r"] # sudo rename
on = ["R", "d"] # sudo delete
# etc...This means every file operation is duplicated — once for normal mode and once for sudo mode. This is hard to remember and clutters the keymap.
Would you be willing to contribute this feature?
- Yes, I'll give it a shot
Describe the solution you'd like
Proposed solution: a sudo mode toggle A single key (e.g. ) would toggle sudo mode on/off. When sudo mode is active, all file operations (paste, rename, delete, chmod, create) would automatically use sudo instead of the normal implementation. Implementation idea using ya.sync state (something similar):
-- State management
local State = ya.sync(function(state, action)
if action == "toggle" then
state.sudo_enabled = not state.sudo_enabled
end
return state.sudo_enabled
end)
-- In the plugin entry point:
if job.args[1] == "toggle" then
local enabled = State("toggle")
ya.notify({
title = "Sudo mode",
content = enabled and "ON " or "OFF",
timeout = 2,
})
return
end
-- For paste, check state instead of separate binding:
if job.args[1] == "paste" then
local is_sudo = State(nil)
if is_sudo then
sudo_paste(state.value)
else
ya.emit("paste", {})
end
return
endKeymap — after:
on = ["<C-t>"] # toggle sudo mode (one binding instead of many)
# all normal bindings work for both modes automaticallyBenefits:
No duplicate key bindings Intuitive — same keys work in both modes Visual feedback when sudo mode is active (statusbar indicator)
Would you be open to adding this? Happy to help test it. Thanks!
Additional context
No response
Checklist
- I have searched the existing issues/discussions
- The latest nightly build doesn't already have this feature
Source: sxyazi/yazi