zellij: Allow zellij run CLI command to block until command has completed
The zellij run command should have the ability to block until the command being run has exited.
This would allow zellij to be invoked in scripts or shortcuts to perform actions and then have control returned to the caller.
For example, my use case is using Helix keybinds to invoke the Yazi file browser to select a file to which will then be opened in Helix. However currently I am unable to block until I’ve selected a file as the zellij command immediately exits.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (1 by maintainers)
I have this working with Yazi and Helix specifically:
@blixenkrone you can open multiple files at once if you change it to
This handles their quoting too.
Thanks @rockboynton and @postsolar!
Here’s (single file) using zsh:
You’re probably executing the script with bash, not zsh, perhaps due to not adding the shebang? Try adding
#! /usr/bin/env zshas the very first line. Or run the bash version from yazi docsThanks for suggesting this feature.
A few things:
While I totally empathize with people wanting this to be part of core, the philosophy of this project is to offload as much as possible to plugins in order to help us maintainers keep up. If someone makes a generic plugin that blocks until a command is done, I’d be happy to link to it and refer to it when this comes up.
ADDENDUM: if someone is interested in implementing this plugin and wants support, they are welcome to join our Discord - there are lots of plugin authors there who’d be happy to help.
For anyone interested in an example of opening yazi in a side-pane (not a floating pane) from a helix keybind & persisting it in view, I’m posting here just because this took me a bit of digging to figure out but it turned out quite nice actually.
(referencing the note in yazi-docs):
config.toml
yazi-picker.sh
@JasterV just add it as an argument? Here is a one-liner for the latest release of Helix:
For any terminal with or without Zellij (using
footas an example here):For zellij:
This assumes
editor.shellin Helix configuration is set a POSIX-compatible shell (true by default on Linux, on MacOS you don’t have access to/proc/).The bash script assumes that the escape key puts the mode back to normal. In my case, the escape key is mapped to capslock and within Helix, my escape key toggles between NORMAL and INSERT mode. So consider making it explicit by mapping the keys in the Helix config like this:
and do not write the escape key in the sh script.
Cool, thank you for sharing it! @rockboynton
Would you like to submit a PR and add it to the Tips page of the Yazi document? This way more people can see it.
Edit: Added to https://yazi-rs.github.io/docs/tips/#helix-with-zellij, fell free to use it 😉
https://github.com/zellij-org/zellij/assets/17523360/4b47ec6b-0282-44ab-814d-d25c0e8d6cf5
BTW I saw this comment from https://www.reddit.com/r/HelixEditor/comments/1chvan1/how_are_people_using_their_cli_file_explorers, hope I’m not too late here 😉