From 7ebe6d481386568e1f834fd009bd3f81ad225fef Mon Sep 17 00:00:00 2001 From: Rock Boynton Date: Tue, 7 May 2024 17:14:49 -0700 Subject: [PATCH] docs: add tip to use Yazi as a Helix file picker with Zellij (#61) Co-authored-by: postsolar <120750161+postsolar@users.noreply.github.com> --- docs/tips.md | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/tips.md b/docs/tips.md index aeca5b6c..6aeb6fce 100644 --- a/docs/tips.md +++ b/docs/tips.md @@ -437,6 +437,35 @@ Copy the [`Header:render()` method](https://github.com/sxyazi/yazi/blob/latest/y ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT), ``` +## File tree picker in Helix with Zellij {#helix-with-zellij} + +Yazi can be used as a file picker to browse and open file(s) in your current Helix instance (running in a Zellij session). + +Add a keymap to your Helix config, for example ' + y: + +```toml +# ~/.config/helix/config.toml +[keys.normal."'"] +y = ":sh zellij run --floating -n 'Yazi picker' -- bash ~/.config/helix/yazi-picker.sh" +``` + +Then save the following script as `~/.config/helix/yazi-picker.sh`: + +```sh +#!/usr/bin/env bash +paths=$(yazi --chooser-file=/dev/stdout | xargs -I {} command printf "%q " {}) +zellij action toggle-floating-panes +zellij action write 27 # send key +zellij action write-chars ":open $paths" +zellij action write 13 # send key +zellij action toggle-floating-panes +zellij action close-pane +``` + +Note: this uses a floating window, but you should also be able to open a new pane to the side, or in place. Review the Zellij documentation for more info. + +Original post: https://github.com/zellij-org/zellij/issues/3018#issuecomment-2086166900, credits to [@rockboynton](https://github.com/rockboynton) and [@postsolar](https://github.com/postsolar) for sharing and polishing it! + ## Make Yazi even faster than fast {#make-yazi-even-faster} While Yazi is already fast, there is still plenty of room for optimization for specific users or under certain conditions: diff --git a/package.json b/package.json index 931f84b9..d92e2662 100644 --- a/package.json +++ b/package.json @@ -44,5 +44,5 @@ "engines": { "node": ">=18.0" }, - "packageManager": "pnpm@9.0.6" + "packageManager": "pnpm@9.1.0" }