-
Notifications
You must be signed in to change notification settings - Fork 42
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
[Feature Request] Shortcut for Reloading Buffers #53
Comments
I wonder if there would be value in adding a file watcher in addition to the key binding suggested to look at the mtime of the current file and update the buffer if it changed. My use case for this is similar to yours where I'd like to run an external application, say rustfmt, to format the file and see the results in zee. This could also be used to get us part way to format on save since zee could kick off the external process to format the file on save and then receive the change event once complete. |
That sounds like a really good idea! Maybe this would also fix the whitespace cropping bug which can break the application, see #42. Do you have a certain starting point in mind, for instance a crate you would like to use for the implementation? |
I was thinking perhaps of using the notify crate and looking at xi-editor's usage as a starting point. https://github.com/xi-editor/xi-editor/blob/master/rust/core-lib/src/watcher.rs . @mcobzarenco What do you think of this idea? Something you want to see in zee or would you rather it be done another way? |
👍 Agreed, reloading the files automatically is a must imo. I'm thinking the following behaviour (similar to emacs):
EDIT: I still there's value in providing a shortcut to reload the buffer, if nothing else, as a stop gap solution. This would also be much easier to implement. |
I've done a rough port of the watcher module from xi-editor I mentioned above and put it up here: iainh@a123b8a. The code is far enough from done that I didn't even want to make it a draft PR but I think it could be interesting as a proof of concept. The basics, refreshing the content of saved files after an external change, work surprisingly well for a quick Friday hack. I'll be travelling for the next week or so and won't be able to work more on this until after that but my next step will be to get it cleaned up enough to turn it into a PR and implement the behaviour mentioned above. |
When working with Zee, it is useful to have a second terminal to do the Git operations there, for instance committing the latest progress, run tests and so on. Sometimes, one needs to restore a previous state of a single file from the Git history. Then, Zee needs to be restarted -- at least in case that the affected file was edited in an opened window -- in order to mirror the changes there.
As a starting point, I would like to suggest to check whether it would be possible to bind the scanning of the current directory of the focused window to a shortcut. The Midnight Commander (
mc
) uses[CTRl] + [R]
therefore but maybe this binding is already reserved for an earlier feature request.The text was updated successfully, but these errors were encountered: