-
Notifications
You must be signed in to change notification settings - Fork 14
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
vim-tpipeline support #46
Comments
Yeah, I feel a bit dumb now. Let me test and I'll provide feedback :) |
Yes, that works! Thank you! I still have the issue with the update interval - it's terrible to watch the line only update every second. What do you think about a file handle? Or some dynamic command to trigger an update? |
Don't feel dumb. The other perspective and ideas help to create new features and ideas! I'm glad that the proposed solution works!
I'm currently a bit indecisive about the file widget. On one side, it's a really specific use-case, which IMO seems to be pretty rare. The other thing that bothers me is, that it will be quite difficult to implement the update mechanism on fs events due to the nature of zellij plugins. To elaborate a bit more on this, here are the details, on the example of how the command widget is working: zellij widgets retrieve events. On these events the plugin then can decide, whether or not the render function will be called or not. Within the render function, there will be an initial call to the command widget, which checks based on a stored/initial state, if the command needs to be re-run according to the configured interval. In case the interval has passed, it runs the command without getting the result directly! Contrarily, zjstatus will obtain a With this behaviour in mind, it will be tough to trigger re-renders based on a changing file, since at least as far as I know there is no way to trigger such events. Maybe the announced pipes for the next zellij release will help us to control the behaviour and to trigger re-renders of certain widgets in zjstatus. Maybe we could add a specific widget for your integration or some other configuration on the interval, that enables you to run the command more often, which improves the given feedback. Another idea I have is to somehow let the vim plugin only write updates to the file. Like a queue. So the command prints and exits on an update, which triggers the Sorry for the long text :D but let's have a discussion how to solve it in a good way! |
Thank you so much for your thorough response! I am not sure about the rarity argument, might be true, but on the other hand it might open a lot of new ideas and implementations of interesting things. About the implementation, well there is bash -c "echo $FILE | entr cat $FILE" on the zjstatus side and everytime that something is printed, I "magically use zjstatus' interface" to print it to the status bar. Seems charming. However, how do you feel about the complexity on your side? Depending on how often the signals arrive, we might not even need that. We can internally store the last-modified-time of the file read before and then call something like ls --time-style=+%s -l $FILE | awk '{print $6}' to get the latest time. The Regarding your idea, it sounds interesting. But how would a command look like that only prints on an update? Do you mean like a script that does
or
Imaginable. Then your plugin would still need a new way to call the script. We want to have exactly one instance of this script running at the same time. How much effort on your side? Though, I don't really like this idea ... yet. |
Thanks for you detailed response. I'll go through the ideas in detail when I have some time (hopefully on the weekend). For the bash part, I thought about something like a FIFO and the Screen.Recording.2024-03-11.at.21.16.50.mov"new loop call" indicates, when the |
One other thing, that comes to my mind is, that a file watcher would only be possible for files in the same directory as zellij is started. Plugins are compiled to WASM and are executed in a sandbox with very limited filesystem access. Currently the command widget is exploiting the fact that zellij runs them on the host, so you are able to reach arbitrary file path. Therefore it will be not really useful to have this widget. Hopefully I get the bug with the FIFO fixed. And I'll try to implement a feature with the newly introduced pipes, that might help you to achieve the goal. |
Thanks for mentioning these tools, such that I can take a look at their implementation. However, as I pointed out in my previous comments, it will be a really limited implementation, since zjstatus would only be able to access files within the directory of the session. This in addition with the (at least right now) missing capability to trigger the render function from everywhere in the code makes it basically impossible to implement a file watcher.
Comparing timestamps as an alternative to fs notifies would be also an option. Not as elegant, but it would work, as you suggest. The main problem there is again, that I'm not able to trigger the render function from the place at which the timestamp is compared. Therefore zjstatus must wait for zellij to send the next event, which could take a few seconds, since the communication is completely event driven.
For this I would refer to the comment with the FIFO. Fortunately I had some time today, which I dedicated to the pipes feature in the upcoming zellij release. There's now a pull request, which leverages the pipes to send control sequences to zjstatus - as rerunning a command. This command in combination with your file and the Otherwise we need to wait until the next zellij version is released. Either way, here's a short demo. The interval for the date command is 10 seconds. Check out, how it is rerun by the pipes after the first initial 10 seconds I waited to demonstrate the configured interval. Screen.Recording.2024-03-12.at.19.21.01.mov |
Thank you SO much for your work! I was sick, please excuse the late response. I am looking forward to test the pipes feature! Sadly I can't compile
However, I didn't dig too deep, yet. Similarly, I have trouble compiling |
No worries :) Have you added the wasm target to your Rust toolchain? Otherwise feel free to ping me if you need some help |
@mrdgo With the zellij release yesterday and zjstatus 0.14.0 you can try the behaviour without building both on your own. |
Thanks for the reminder, I will look into it as soon as time allows me to :) |
Hey @mrdgo , do you have any updates on this one? Would be great to finally solve this issue :) Is there any way I can support you with this feature? |
Hey @dj95, I don't, because I honestly don't use zellij anymore. Neovim's internal terminal is more than sufficient for all of my use cases. Having that said, vimposter was very open to help, as well. So when/if someone in the future wants to give this another try, I am sure that they will find a solution or enough support to find one. Thanks for your support and see you around! Kind regards, |
Is your feature request related to a problem? Please describe.
I am currently working on nvim-zjstatus-pipeline. So far, it seems feasible. However, I cannot create a command like
Because the command handle neither evaluates
$()
commands nor environment variables.Describe the solution you'd like
I request considering one of the following:
command
handles evaluate nested commands or at least env variables.Additional context
Please don't hesitate to ask anything if I didn´t express this clearly enough.
The text was updated successfully, but these errors were encountered: