From 207961e3974807f0f23ead3568eef0d0b86c29eb Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sun, 19 Jan 2025 22:06:58 +0100 Subject: [PATCH] better yazi bindings --- home-modules/yazi.nix | 55 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/home-modules/yazi.nix b/home-modules/yazi.nix index 1df41c0..1f55cc7 100755 --- a/home-modules/yazi.nix +++ b/home-modules/yazi.nix @@ -1,5 +1,4 @@ - -{ pkgs, system, rice, inputs, ... }: +{ pkgs, lib, system, rice, inputs, ... }: { home.packages = with pkgs; [ # yazi @@ -18,7 +17,7 @@ }; # initLua = /* lua */ '' ''; keymap = { - keymap = [ + manager.keymap = [ { on = ""; run = "escape"; desc = "Exit visual mode, clear selected, or cancel search"; } { on = "q"; run = "quit"; desc = "Exit the process"; } { on = "Q"; run = "quit --no-cwd-file"; desc = "Exit the process without writing cwd-file"; } @@ -61,11 +60,12 @@ { on = "K"; run = "seek -5"; desc = "Seek up 5 units in the preview"; } { on = "J"; run = "seek 5"; desc = "Seek down 5 units in the preview"; } # Selection - { on = ""; run = [ "select --state=none" "arrow 1" ]; desc = "Toggle the current selection state"; } + { on = ""; run = [ "toggle --state=none" "arrow 1" ]; desc = "Toggle the current selection state"; } { on = "v"; run = "visual_mode"; desc = "Enter visual mode (selection mode)"; } { on = "V"; run = "visual_mode --unset"; desc = "Enter visual mode (unset mode)"; } - { on = ""; run = "select_all --state=true"; desc = "Select all files"; } - { on = ""; run = "select_all --state=none"; desc = "Inverse selection of all files"; } + { on = ""; run = "toggle_all --state=on"; desc = "Select all files"; } + { on = ""; run = "toggle_all --state=off"; desc = "Deselect all files"; } + { on = ""; run = "toggle_all --state=none"; desc = "Inverse selection of all files"; } # Operation { on = "o"; run = "open"; desc = "Open selected files"; } { on = "O"; run = "open --interactive"; desc = "Open selected files interactively"; } @@ -126,6 +126,7 @@ { on = [ "," "S" ]; run = [ "sort size --reverse" "linemode size" ]; desc = "Sort by size (reverse)"; } # Tab { on = "t"; run = "tab_create --current"; desc = "Create a new tab with CWD"; } + { on = ""; run = "close"; desc = "Close the current tab"; } { on = "1"; run = "tab_switch 0"; desc = "Switch to the first tab"; } { on = "2"; run = "tab_switch 1"; desc = "Switch to the second tab"; } { on = "3"; run = "tab_switch 2"; desc = "Switch to the third tab"; } @@ -135,14 +136,46 @@ { on = "7"; run = "tab_switch 6"; desc = "Switch to the seventh tab"; } { on = "8"; run = "tab_switch 7"; desc = "Switch to the eighth tab"; } { on = "9"; run = "tab_switch 8"; desc = "Switch to the ninth tab"; } + { on = ""; run = "tab_swap 0"; desc = "Swap current tab with the first tab"; } + { on = ""; run = "tab_swap 1"; desc = "Swap current tab with the second tab"; } + { on = ""; run = "tab_swap 2"; desc = "Swap current tab with the third tab"; } + { on = ""; run = "tab_swap 3"; desc = "Swap current tab with the fourth tab"; } + { on = ""; run = "tab_swap 4"; desc = "Swap current tab with the fifth tab"; } + { on = ""; run = "tab_swap 4"; desc = "Swap current tab with "; } + { on = ""; run = "tab_swap 5"; desc = "Swap current tab with the sixth tab"; } + { on = ""; run = "tab_swap 5"; desc = "Swap current tab with "; } + { on = ""; run = "tab_swap 6"; desc = "Swap current tab with the seventh tab"; } + { on = ""; run = "tab_swap 6"; desc = "Swap current tab with tab"; } + { on = ""; run = "tab_swap 7"; desc = "Swap current tab with the eighth tab"; } + { on = ""; run = "tab_swap 7"; desc = "Swap current tab with b"; } + { on = ""; run = "tab_swap 8"; desc = "Swap current tab with the ninth tab"; } + { on = ""; run = "tab_swap 8"; desc = "Swap current tab with "; } { on = "["; run = "tab_switch -1 --relative"; desc = "Switch to the previous tab"; } + { on = "["; run = "tab_switch -1 --relative"; desc = "Switch to thtab"; } { on = "]"; run = "tab_switch 1 --relative"; desc = "Switch to the next tab"; } + { on = "]"; run = "tab_switch 1 --relative"; desc = "Switch ttab"; } { on = "{"; run = "tab_swap -1"; desc = "Swap current tab with previous tab"; } + { on = "{"; run = "tab_swap -1"; desc = "Swap current tab wittab"; } { on = "}"; run = "tab_swap 1"; desc = "Swap current tab with next tab"; } - # Task + # Tasks { on = "w"; run = "tasks_show"; desc = "Show task manager"; } - # Hel + ]; + tasks.keymap = [ + # Task + { on = "w"; run = "close"; desc = "Close Task View"; } + { on = "q"; run = "close"; desc = "Close Task View"; } + { on = ""; run = "close"; desc = "Close Task View"; } + { on = "c"; run = "cancel"; desc = "Cancel Task"; } + { on = "i"; run = "inspect"; desc = "Inspect Task"; } + { on = "j"; run = "arrow -1"; desc = "Up in list"; } + { on = "k"; run = "arrow 1"; desc = "Down in list"; } + { on = "u"; run = "arrow -5"; desc = "Up in list (fast)"; } + { on = "d"; run = "arrow 5"; desc = "Down in list (fast)"; } + ]; + help = [ + # Help { on = "~"; run = "help"; desc = "Open help"; } + { on = "?"; run = "help"; desc = "Open help"; } { on = ""; run = "help"; desc = "Open help"; } ]; }; @@ -175,10 +208,12 @@ { run = ''imv "$@"''; desc = "imv"; } { run = ''gimp "$@"''; desc = "gimp"; } { run = ''swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120 "$@"''; desc = "swww wallpaper"; } + { run = ''exiftool "$@"; echo "Press enter to exit"; read''; desc = "View Exif Data"; } + { run = ''for f in "$@"; do magick "$f" -auto-orient "''${f%.*}.pdf"; done''; desc = "Convert to PDF"; } ]; "svg" = [ { run = ''inkscape "$@"''; desc = "inkscape";} - { run = ''firefoc "$@"''; desc = "firefox";} + { run = ''firefox "$@"''; desc = "firefox";} ]; "font" = [ { run = ''fontpreview "$@"''; desc = "fontpreview"; } @@ -206,7 +241,7 @@ "shell" = [ { run = ''bash -c "$@"''; desc = "bash -c"; } { run = ''fish -c "$@"''; desc = "fish -c"; } - { run = ''sh -c "$@"''; desc = "sh -c"; } + { run = ''sh -c "$@"''; desc = "sh -c"; } ]; "python" = [ { run = ''python "$@"''; desc = "python"; }