-
PremiseI know a file manager got merged a while ago, however my release (on nixpkgs unstable) does not have it and I would prefer using yazi within Helix to interact with files anyway. Attempted SolutionThis video explains how to use LazyGit inside Helix. The video maps "C-g" = [":new", ":insert-output lazygit", ":buffer-close!", ":redraw"] Which then allows you to press I tried to do the same with yazi, with little success. I expected "C-f" = [":new", ":insert-output yazi --chooser-file=/dev/stdout", ":buffer-close!", ":redraw"] to work, however when I press |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 15 replies
-
Hi, Yazi author here 👋 I added support for using Yazi directly in Helix (without needing Zellij or tmux) in sxyazi/yazi#2461, which only requires a keybinding: [keys.normal]
C-y = [
':sh rm -f /tmp/unique-file',
':insert-output yazi %{buffer_name} --chooser-file=/tmp/unique-file',
':insert-output echo "\x1b[?1049h\x1b[?2004h" > /dev/tty',
':open %sh{cat /tmp/unique-file}',
':redraw',
] See sxyazi/yazi#2461 for more info! Demoscreenshot-002279.mp4Bonus: You can even preview images and videos within Helix!screenshot-002284.mp4 |
Beta Was this translation helpful? Give feedback.
-
works like a charm |
Beta Was this translation helpful? Give feedback.
-
I am not using nix. I am on maxOs. Here is my config entry e = [ that said, when I press the "space+e" to open my yazi instance and select a file in yazi, I am seeing two files are being created and they are opened in two new buffers. They are "%sh{cat" and "unique-file}" (without the quotes- they are mine). Can you please help me out what I might be doing wrong here? I just copied the code from above. |
Beta Was this translation helpful? Give feedback.
-
It would be nice that it worked when selecting multiple files. For example, in the shell (nushell in my case) i can do I also tryed escaping the paths but it didnt work. |
Beta Was this translation helpful? Give feedback.
-
Using the configuration provided in the answer, Yazi opens inside Helix, but when I select a file, Helix just opens It seems there is a race condition between the command that writes the file path and the command that reads from the file: Helix tries to read /tmp/unique-file before Yazi has written to it. As a result, Helix opens the chooser file itself, not the actual file I selected. How can I fix this? |
Beta Was this translation helpful? Give feedback.
-
If using zellij, you can do the following which even supports opening multiple files at once: Yazi config (opener): This is a general technique which I also use for lazygit. Here I used floating panes, but zellij allows many other configurations (sidebar, new tab etc). |
Beta Was this translation helpful? Give feedback.
-
If the above solution doesn't work, then this will work:
|
Beta Was this translation helpful? Give feedback.
Hi, Yazi author here 👋
I added support for using Yazi directly in Helix (without needing Zellij or tmux) in sxyazi/yazi#2461, which only requires a keybinding:
See sxyazi/yazi#2461 for more info!
Demo
screenshot-002279.mp4
Bonus: You can even preview images and videos within Helix!
screenshot-002284.mp4