From 32a71872147f6c9776f45b2ca70a8a0c9933e91f Mon Sep 17 00:00:00 2001 From: Matthew Ryan Dillon Date: Thu, 14 Nov 2024 11:27:52 +0800 Subject: [PATCH] feat: yazi support --- home/private_dot_config/helix/config.toml | 1 + home/private_dot_config/helix/yazi-picker.sh | 12 ++++++++++++ home/run_once_01install-packages.sh.tmpl | 2 ++ 3 files changed, 15 insertions(+) create mode 100644 home/private_dot_config/helix/yazi-picker.sh diff --git a/home/private_dot_config/helix/config.toml b/home/private_dot_config/helix/config.toml index dfb9549..166702f 100644 --- a/home/private_dot_config/helix/config.toml +++ b/home/private_dot_config/helix/config.toml @@ -9,6 +9,7 @@ hidden = false [keys.normal] C-r = ":reload-all" +C-y = ":sh zellij run -c -f -x 10% -y 10% --width 80% --height 80% -- bash ~/.config/helix/yazi-picker.sh open" [keys.normal.C-m] t = ":sh run_test_under_cursor" diff --git a/home/private_dot_config/helix/yazi-picker.sh b/home/private_dot_config/helix/yazi-picker.sh new file mode 100644 index 0000000..4d4d1b3 --- /dev/null +++ b/home/private_dot_config/helix/yazi-picker.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +paths=$(yazi --chooser-file=/dev/stdout | while read -r; do printf "%q " "$REPLY"; done) + +if [[ -n "$paths" ]]; then + zellij action toggle-floating-panes + zellij action write 27 # send key + zellij action write-chars ":$1 $paths" + zellij action write 13 # send key +else + zellij action toggle-floating-panes +fi diff --git a/home/run_once_01install-packages.sh.tmpl b/home/run_once_01install-packages.sh.tmpl index 1dc7c61..0d2b399 100644 --- a/home/run_once_01install-packages.sh.tmpl +++ b/home/run_once_01install-packages.sh.tmpl @@ -34,6 +34,7 @@ sudo port install \ wget \ xz \ zellij \ + yazi \ zk \ zsh @@ -48,6 +49,7 @@ sudo apt install \ tmux \ tree \ wget \ + yazi \ -y {{ end }}