zellij
zellij copied to clipboard
Feature Request: (Re-)Run a command in an existing pane with a keybind
Background
Hey folks, first of I am in love with this project, it is so easy to use, thank you so much for your effort <3
I am a lazy person and I wanted to have a single button I could push to start compilation (or something else) in some layouts I was making for myself. For example, when writing a LaTeX document, I would want to push <F9> to build my LaTeX document and have the build log displayed somewhere. Similar logic applies to other processes.
For now I have implemented this by creating the following keybind:
bind "F9" {
Run "make";
TogglePaneEmbedOrFloating;
}
This is however a bit strange as focus doesn't reliably return to the same frame and some compilation processes need a long time and having a float block your view can be annoying for that time. I was wondering if some kind of feature could be implemented to make this a bit nicer.
Ideas
Idea 1: float Run
This could probably be solved by adding 'floating'
as a direction option to Run
. Unfortunately, this only solves the jankyness of my current solution.
Idea 2: GoToPane
Some kind of GoToPane
action that allows you to change focus to a (named?) pane could also work. Then I would have a layout with a pane named build
and one named main.tex
and the keybind could look something like this:
bind "F9" {
GoToPane "build"; // or other identifier?
InsertChars " ";
GoToPane "main.tex"; // or other identifier?
}
I thought that there is a reason you don't have a GoToPane
and since it isn't clear how you identify an arbitrary pane to go to I don't know if that is something that can be implemented in this project.
Idea 3: RerunPane
Alternatively a command called something like RerunPane
could perhaps be used to rerun a pane.
Unfortunately, this comes with the problems from Idea 2.
It would potentially look like this:
bind "F9" {
RerunPane "build"; // or other identifier
}
Idea 4: RerunPaneOrRun
After chatting with @har7an, Idea 3 could go a step further and basically:
- Check if a pane with a given command/argument combination exists.
- If the pane exists, rerun the contents
- If the pane doesn't exist, run the command/argument in a pane with a given direction (up/down/right/left/float).
I don't know if identifying a pane by the command/argument combination is a sane idea though.
This could look something like this:
bind "F9" {
RerunPaneOrRun "make" {
direction "Floating"
};
}
Summary
In a nutshell, I think I am just looking for some feature that will allow me to push a button that will (re)run my build commands in panes that I started for build commands.
Idk, what do you think? Are any of these feasible in some way?
Hi.
I don't want to hijack this issue, but my idea is somewhat related, so I think adding it here would be a good idea.
My workflow is almost the same, except that my build runs automatically. So I have a "watch" tool, that watches my project files. If they change, the "watch" tool re-runs the build. I can have that running in a seperate terminal (either a split or a floating terminal).
Problem is: It's in my way most of the time. I only want to see it if there's some progress in the output (plus some timeout).
So my wish would be to have something like this:
- Open
<command>
in a floating terminal - Hide that terminal by default
- If there's output/progress in that terminal, show it. If the progress stops, hide it again (plus some configurable timeout)
I think this beats into the same direction as the idea from @lysogeny here.
I'd love to be able to float the Run
action. I have an idea I mentioned in #3106 but after doing some more reading I think the only way to implement it is to make a plugin so I can LaunchOrFocusPlugin
with float.
Unfortunately this means I need to find time to teach myself rust or figure out how to get WASM working with one of the languages I do know.