-
Notifications
You must be signed in to change notification settings - Fork 643
feat: support using Yazi in Helix directly without Zellij or tmux #2461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Does this depend on terminal emulator? I try to replicate the same thing on Windows Terminal, but at This is my helix config (I use nushell): [editor]
shell = ["nu", "-c"]
C-y = [
':sh $env.temp | path join yazi-path | rm -f $in',
':insert-output yazi %{buffer_name} --chooser-file %sh{ $env.temp | path join yazi-path }',
':open %sh{ $env.temp | path join yazi-path | cat $in }',
':redraw'
]A powershell implementation may look like this but I haven't tested it. |
|
I just tested it on Windows, and everything seems to be working fine (ignore icons and previews, test environment, didn't spend much time configuring them): screenshot-002286.mp4Are your Helix and Yazi on the latest nightly? What's your terminal version? Mine: MS Terminal: Helix config: [keys.normal]
C-y = [
':sh del C:\yazi-path.txt',
':insert-output C:\Users\Ika\Downloads\yazi-aarch64-pc-windows-msvc\yazi.exe %{buffer_name} --chooser-file=C:\yazi-path.txt',
':open %sh{type C:\yazi-path.txt}',
':redraw'
] |
|
Oops, my bad, I pull the latest yazi and then install |
|
This is what i've been waiting for, thanks so much for implementing this! Running into an issue when configuring however. Here are my versions:
I've added the following to my helix config: Restarting helix and hitting Ctrl+y drops the following into helix:
Additionally, i'm a little confused about the first line Thanks again for your efforts, very much appreciated! |
|
you seem to have copied the wrong config commands. your paths to |
Makes sense thanks, assumption lead me to believe that would reference my binary edit: Copy + pasted the config from the initial PR message with the same results |
|
Something is not right on my side, I need help. ❯ yazi --version
Yazi 25.3.2 (Arch Linux 2025-03-05)
~
❯ $EDITOR --version
helix 25.01.1 (dc4761ad)
~
❯ ghostty --version
Ghostty 1.1.2-archC-y with the given config just hangs helix, when I do C-c: |
@vishalpaudel You're not using the latest nightly of Yazi, the latest nightly version is |
|
@noahfraiture I updated the command for Unix-like systems to include I'm not sure how Windows outputs |
I mainly use nushell but based on this link it seems the escape character for cmd is |
|
@sxyazi building from source on arch is failing for me: ❯ uname -a
Linux turing 6.13.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 27 Feb 2025 18:09:44 +0000 x86_64 GNU/LinuxI tried through AUR, cargo install --git, and cargo build from git source. Part of the log can be found below, what is the issue, am I missing any dependency? |
|
@vishalpaudel That's weird, it looks like an environment issue since it passed the build in our CI. If you're having trouble building Yazi, you can download the official nightly binary. If you're using Arch Linux, you can also install the |
|
@sxyazi I have already failed to built I don't know what might be wrong with my environment as the dependencies mentioned are already installed. Nevermind, using |
|
Update: added a few tips |
|
Not sure if mentioned, but after loading yazi in Helix following this method causes anything pasted from clipboard to lose its original structure. Pasting a code block for example, results in some very interesting random indentation. I noticed this writing notes in markdown, but have tested python files too with the same result. Edit: this only seems to affect pasting from system clipboard. Screen.Recording.2025-03-11.at.21.29.16.mov |
|
@ionztorm Updated the new command, please try it out |
Hey sxyazi, With the updated command, I no longer get the warning notification, but the indentation is still weird, see below: Screen.Recording.2025-03-12.at.08.03.45.mov |
|
Cool!!! |
Screencast.From.2025-03-14.17-10-37.mp4When closing Helix using |
|
@atheeq-rhxn Hi, I updated the keybinging in the PR earlier, which should fix your issue - are you using the latest code? If it's still not working, you can try simply |
I am having this same issue using the latest code (commit 7632163), in both Kitty and WezTerm. |
|
I am too on nushell and it should work. Do you build helix on main branch instead of last release ? |
|
Oh nope, i totally forgot, im on last release Edit: now it works, thx! |
|
Any way to add this to nixos using home-manager? Tried adding it to my existing config, but it doesn't seem to like the syntax. Anyone have any luck? |
you need to have both yazi and helix on the latest version, helix is not up to date on nixpkgs yet iirc (even unstable) so you need to add them manually. You can take a look at my configurations here, here and here, helix and yazi's respective configs are in |
|
@sxyazi on another note i originally wanted to report that the redraw issue is still present with the updated keybinds that you provided(at least on wezterm), and aliasing |
|
When working on Expo projects that use Expo Router, some directories may be named with parentheses, like So to fix this wrap [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',
] |
I'm currently trying out lazygit integration with helix similar to this and the redraw issue is also present there so i think this is not yazi causing the helix editor to not be cleared upon exit |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [sxyazi/yazi](https://github.com/sxyazi/yazi) | minor | `v25.3.2` -> `v25.4.8` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>sxyazi/yazi (sxyazi/yazi)</summary> ### [`v25.4.8`](https://github.com/sxyazi/yazi/releases/tag/v25.4.8) [Compare Source](sxyazi/yazi@v25.3.2...v25.4.8) #### Breaking Changes - Supported wraparound navigation and enabled it by default. sxyazi/yazi#2485 - Replaced `tasks_show` and `close_input` with `tasks:show` and `input:close`. sxyazi/yazi#2530 - `frag`, `name`, `stem`, `ext`, and `parent` on [`Url`](https://yazi-rs.github.io/docs/plugins/types#shared.url), `name` on [`tab::Tab`](https://yazi-rs.github.io/docs/plugins/types#app-data.tab-tab), and `is_hovered` on [`fs::File`](https://yazi-rs.github.io/docs/plugins/types#app-data.fs-file) are now properties. sxyazi/yazi#2572 - Swapped the default key bindings for `z` (zoxide) and `Z` (fzf). sxyazi/yazi#2546 - Used the new `@sync peek` annotation instead of the previewer's `sync = true`. sxyazi/yazi#2487 #### Deprecated - `ui.Padding` and `ui.Rect:padding()` are deprecated. sxyazi/yazi#2574 #### Packaging - SVG preview backend switched from ImageMagick to [`resvg`](https://github.com/linebender/resvg) and implemented as a new `svg` previewer. sxyazi/yazi#2533, sxyazi/yazi#2581 #### Custom Search Engine Lua API With sxyazi/yazi#2452, you can create custom search engines via the Lua API, meaning that plugins can serve as the source for search view file lists. A new plugin [vcs-files.yazi](https://github.com/yazi-rs/plugins/tree/main/vcs-files.yazi) is available to display the list of files changed in Git within Yazi: https://github.com/user-attachments/assets/ca6f7d55-002b-4933-b8e8-41f335b96a2b #### Platform-Specific Key Binding sxyazi/yazi#2526 adds a new *optional* `for` field to key bindings to specify the platform the key binding applies to. For example: ```sh { on = [ 'g', 'd' ], run = 'cd ~/dev', desc = 'Go dev', for = 'unix' }, { on = [ 'g', 'd' ], run = 'cd C:\dev', desc = 'Go C:\dev', for = 'windows' }, ``` #### Performance Improvements This version brings several performance enhancements: - Configuration parser has been rewritten to double the startup speed. sxyazi/yazi#2508 - AVIF, HEIF, and JPEG XL previews have seen significant performance improvements. sxyazi/yazi#2533, thanks [@​ze0987](https://github.com/ze0987) - Compiled and cached the Lua bytecode to enhance the overall performance of the plugin system. sxyazi/yazi#2490 #### Enhance `fzf` Integration Now, you can select multiple files in `fzf`, and the selected files will also be selected in Yazi. Also, you can now view, navigate, and deselect the file selection list from Yazi within `fzf`. https://github.com/user-attachments/assets/f7b175a3-fa73-4128-8239-f90e45f13ab3 See sxyazi/yazi#2546 for more details. #### Use Yazi File Manager Directly in Helix, Without Zellij or tmux sxyazi/yazi#2461 adapted Yazi to support Helix's `:insert-output`, which means you can now run Yazi directly within Helix – it even supports image and video previews! https://github.com/user-attachments/assets/9dbf7aca-fc4e-4f9e-b554-70cadedf0484 #### New `prev` and `next` Arguments to `arrow` for Wraparound Navigation Circular navigation is one of the long-requested features, and is now supported via the new `arrow prev` and `arrow next` commands in sxyazi/yazi#2485. #### New `follow` Command to Follow Files Pointed to by Symlinks sxyazi/yazi#2543 adds support for following files pointed to by symlinks. A new key binding, `g` => `f` (follow hovered symlink), has been added to use this feature. #### Allow Initializing Input When Opening It with Commands Like `rename`, `create`, `find`, `filter`, etc. With sxyazi/yazi#2578, you can now customize the input box opened by commands such as `create`, `rename`, `cd`, `filter`, `find`, `search`, and `shell`. For example: ```sh { on = "r", run = [ "rename", "input:escape" ] } ``` This will open the rename input box and exit insert mode, meaning that the default state will be normal mode. #### What's Changed - feat: new `<C-A>` and `<C-E>` keybindings to select entire line for the input component by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2439 - fix: reserve a hack for Zellij to force an image adapter by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2441 - feat: new `rt.term` exports terminal emulator information by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2442 - fix: always show the size in the status bar even in empty directories by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2449 - feat: allow `tab_swap` to cycle tabs by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2456 - feat: support using Yazi in Helix directly without Zellij or tmux by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2461 - refactor: prefer `WriteConsoleW` for Windows console output by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2464 - ci: add label only if not removed manually by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2470 - fix: force ANSI for keyboard progressive enhancement on Windows by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2474 - feat: new `fs.expand_url` API by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2476 - feat!: file navigation wraparound with new `arrow prev` and `arrow next` commands by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2485 - feat!: new `@sync peek` annotation for sync previewers by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2487 - perf: lazy compile and cache lua plugins as binary bytecode by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2490 - feat: new `base` field for the `Url` userdata by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2492 - feat: allow repositioning the cursor in the `rename` DDS event by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2521 - feat: new `symlink_target` to style the target of symbolic links by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2522 - feat: platform-specific key binding by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2526 - feat: show error message when directory fails to load by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2527 - feat: allow bulk renaming to include trailing content in addition to the required new names by [@​MikuGeek](https://github.com/MikuGeek) in sxyazi/yazi#2494 - refactor!: remove unnecessary `tasks_show` and `close_input` commands by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2530 - perf!: faster image preview with optimized `magick` arguments by [@​ze0987](https://github.com/ze0987) in sxyazi/yazi#2533 - feat!: support `arrow prev` and `arrow next` for more components by [@​XOR-op](https://github.com/XOR-op) in sxyazi/yazi#2540 - feat: clear terminal before displaying EXIF data by [@​Integral-Tech](https://github.com/Integral-Tech) in sxyazi/yazi#2541 - feat: new `follow` command to follow files pointed to by symlinks by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2543 - fix: always check whether the cursor exceeds the upper bound to guard against unexpected values by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2551 - feat!: enhance `fzf` integration by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2553 - feat: support Warp terminal image preview by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2571 - feat: allow initializing input when opening it with commands like `rename`, `create`, `find`, `filter`, etc. by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2578 - fix: ignore XQuartz `$DISPLAY` variable by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2586 - fix: don't fail on videos with embedded images by [@​ze0987](https://github.com/ze0987) in sxyazi/yazi#2590 #### New Contributors - [@​MikuGeek](https://github.com/MikuGeek) made their first contribution in sxyazi/yazi#2494 - [@​ze0987](https://github.com/ze0987) made their first contribution in sxyazi/yazi#2533 **Full Changelog**: sxyazi/yazi@v25.3.2...v25.4.8 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xMS4yIiwidXBkYXRlZEluVmVyIjoiNDAuMTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
I've been keeping an eye on Helix's development, and last week they merged a PR for command extensions, which now makes it possible for Helix to interact with external programs.
I was so excited about it that I immediately thought of a use case: running Yazi for file management within Helix. So, this PR supports that!
Usage
Make sure you have:
Then simply add the following key bindings to your Helix configuration file:
Then, click
Ctrl+yto summon Yazi in Helix, and return to Helix seamlessly when you select and open a file in Yazi.If you're on Windows, use this:
Tips
Open the current working directory instead of the active buffer
Just remove
%{buffer_name}from the command, since Yazi opens the CWD by default:Mouse support
If both Helix and Yazi have mouse support enabled, they will conflict, you can use this trick to reset the mouse state when exiting Yazi and returning to Helix:
Go to the project root
You can add a keybinding to Yazi that takes you to the project root when clicked: https://yazi-rs.github.io/docs/tips/#cd-to-git-root
If you don't want to click and prefer to start Yazi directly in the project root, add the following to your Yazi's
init.lua:and launch Yazi with
GO_ROOT=1:Demo
screenshot-002279.mp4
Bonus: You can even preview images and videos within Helix!
screenshot-002284.mp4