edit yazi config

Signed-off-by: Hadi <hadi@example.com>
This commit is contained in:
Hadi
2026-06-09 13:29:26 +02:00
parent 79351e46a1
commit 2f89759ca7
+101 -39
View File
@@ -1,18 +1,22 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.yazi = { programs.yazi = {
enable = true; enable = true;
shellWrapperName = "y"; shellWrapperName = "y";
plugins = { plugins = {
git = { package = pkgs.yaziPlugins.git; setup = true; }; git = {
package = pkgs.yaziPlugins.git;
setup = true;
};
ouch = pkgs.yaziPlugins.ouch; ouch = pkgs.yaziPlugins.ouch;
piper = pkgs.yaziPlugins.piper; piper = pkgs.yaziPlugins.piper;
convert = pkgs.yaziPlugins.convert; convert = pkgs.yaziPlugins.convert;
"full-border" = { package = pkgs.yaziPlugins."full-border"; setup = true; }; "full-border" = {
"toggle-pane" = pkgs.yaziPlugins."toggle-pane"; package = pkgs.yaziPlugins."full-border";
setup = true;
};
"jump-to-char" = pkgs.yaziPlugins."jump-to-char"; "jump-to-char" = pkgs.yaziPlugins."jump-to-char";
"wl-clipboard" = pkgs.yaziPlugins."wl-clipboard"; "wl-clipboard" = pkgs.yaziPlugins."wl-clipboard";
starship = { package = pkgs.yaziPlugins.starship; setup = true; };
"batch-rename-gui" = pkgs.yaziPlugins.mkYaziPlugin { "batch-rename-gui" = pkgs.yaziPlugins.mkYaziPlugin {
pname = "batch-rename-gui.yazi"; pname = "batch-rename-gui.yazi";
version = "0-unstable-2025-07-08"; version = "0-unstable-2025-07-08";
@@ -23,54 +27,112 @@
hash = "sha256-3RviPY3WOyYi5GWXWRYMWp6VLxCe5cuJX7Kb7AyWxLE="; hash = "sha256-3RviPY3WOyYi5GWXWRYMWp6VLxCe5cuJX7Kb7AyWxLE=";
}; };
}; };
"command-palette" = pkgs.yaziPlugins.mkYaziPlugin {
pname = "command-palette.yazi";
version = "0-unstable-2025-07-08";
src = pkgs.fetchFromGitHub {
owner = "Mr-Ples";
repo = "command-palette.yazi";
rev = "e5e61057381e2642d36ba5b9a4977c8196bc1791";
hash = "sha256-Mt1q05YgexMyHpy8qQ778jBny9f7XrftDZXjzONZVxg=";
};
installPhase = ''
runHook preInstall
substituteInPlace main.lua \
--replace 'line = line:gsub' 'local line = line:gsub'
cp -r . $out
runHook postInstall
'';
};
}; };
settings.mgr.ratio = [ 1 4 3 ]; settings.mgr.ratio = [0 4 3];
settings.plugin = { settings.plugin = {
prepend_fetchers = [ prepend_fetchers = [
{ url = "*"; run = "git"; group = "git"; } {
{ url = "*/"; run = "git"; group = "git"; } url = "*";
run = "git";
group = "git";
}
{
url = "*/";
run = "git";
group = "git";
}
]; ];
prepend_previewers = [ prepend_previewers = [
{ url = "*.md"; run = ''piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"''; } {
url = "*.md";
run = ''piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"'';
}
]; ];
prepend_openers = [ prepend_openers = [
{ url = "*.{zip,tar,gz,bz2,xz,7z,rar}"; run = "ouch"; } {
url = "*.{zip,tar,gz,bz2,xz,7z,rar}";
run = "ouch";
}
]; ];
}; };
keymap.mgr.prepend_keymap = [ keymap.mgr.prepend_keymap = [
{ on = ["C"]; run = "plugin ouch"; desc = "Compress"; } {
{ on = ["X"]; run = "plugin ouch --args=extract"; desc = "Extract"; } on = ["C"];
{ on = ["c" "p"]; run = "plugin convert -- --extension='png'"; desc = "Convert to PNG"; } run = "plugin ouch";
{ on = ["c" "j"]; run = "plugin convert -- --extension='jpg'"; desc = "Convert to JPG"; } desc = "Compress";
{ on = ["c" "w"]; run = "plugin convert -- --extension='webp'"; desc = "Convert to WebP"; } }
{ on = ["M"]; run = ''shell 'exiftool "$@" | less' --block''; desc = "Show metadata"; } {
{ on = ["T"]; run = "plugin toggle-pane min-parent"; desc = "Toggle parent pane"; } on = ["X"];
{ on = ["F"]; run = "plugin jump-to-char"; desc = "Jump to char"; } run = "plugin ouch --args=extract";
{ on = ["Y"]; run = "plugin wl-clipboard"; desc = "Copy to clipboard (Wayland)"; } desc = "Extract";
{ on = ["B"]; run = "plugin batch-rename-gui"; desc = "Batch rename"; } }
{ on = [";"]; run = "plugin command-palette"; desc = "Command palette"; } {
on = ["c" "p"];
run = "plugin convert -- --extension='png'";
desc = "Convert to PNG";
}
{
on = ["c" "j"];
run = "plugin convert -- --extension='jpg'";
desc = "Convert to JPG";
}
{
on = ["c" "w"];
run = "plugin convert -- --extension='webp'";
desc = "Convert to WebP";
}
{
on = ["M"];
run = ''shell 'exiftool "$@" | less' --block'';
desc = "Show metadata";
}
{
on = ["T"];
run = "plugin toggle-parent";
desc = "Toggle parent pane";
}
{
on = ["F"];
run = "plugin jump-to-char";
desc = "Jump to char";
}
{
on = ["Y"];
run = "plugin wl-clipboard";
desc = "Copy to clipboard (Wayland)";
}
{
on = ["B"];
run = "plugin batch-rename-gui";
desc = "Batch rename";
}
{
on = [";"];
run = "plugin command-palette";
desc = "Command palette";
}
]; ];
}; };
home.packages = with pkgs; [ glow ouch hexyl exiftool starship fzf ]; home.packages = with pkgs; [glow ouch hexyl exiftool starship fzf];
xdg.configFile."yazi/plugins/toggle-parent.yazi/main.lua".text = ''
--- @sync entry
local RESTORE_WIDTH = 1
return {
entry = function(st, job)
local r = rt.mgr.ratio
if r.parent == 0 then
rt.mgr.ratio = { st.width or RESTORE_WIDTH, r.current, r.preview }
else
st.width = r.parent
rt.mgr.ratio = { 0, r.current, r.preview }
end
ya.emit("app:resize", {})
end
}
'';
} }