Skip to content
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

Instantaneous reload of changed files on focused tab #2603

Closed
fightthepower opened this issue Oct 1, 2020 · 7 comments
Closed

Instantaneous reload of changed files on focused tab #2603

fightthepower opened this issue Oct 1, 2020 · 7 comments

Comments

@fightthepower
Copy link

I am using the latest version 1.36 of geany and I am using custom build commands to format my files, rustfmt "%f". I have enabled all the file saving options on reload available under preference>various except file.show_keep_edit_history_on_reload_msg.

The problem is after formatting my codes in order to see the changes to the file I have to interact with geany by clicking some random tab or menu items. The files are not reloaded instantaneously. Another problem is this reload doesn't work 100 percentage every time. Some times nothing changes in the files despite the file changing in the disk itself.

@codebrainz
Copy link
Member

#2587 (comment)

@fightthepower
Copy link
Author

Can you give me a simple example for that. I really don't get the piping method.

@codebrainz
Copy link
Member

You set a custom command (Edit->Format->Send Selection To->Set Custom Commands) and then when you activate it, it takes the selection and then sends it to the standard input of the command (in this case rustfmt) which does its thing (in this case formats Rust code) and then sends the result out of its standard output, which Geany then replaces the current selection with.

For example if you set rustfmt as the first custom command, the key sequence Ctrl+a Ctrl+1 would format the entire current document.

@fightthepower
Copy link
Author

I already have a similar set up with Build->Set Build Commands , it works and formats the code in the disk. But the issue is the changes to the file is not reflected in the opened file in geany unless I interact with the menu.

@elextr
Copy link
Member

elextr commented Oct 3, 2020

@fightthepower the reason you have been advised to use the custom commands is that they reload the buffer with the formatted output.

Build commands build executables, so there is normally nothing that can be reloaded, so they don't.

@fightthepower
Copy link
Author

Ok thanks now I got it, I would personally love a direct button in the toolbar which when clicked formats my whole code without a need to selecting the lines and then sending it terminal.

@codebrainz
Copy link
Member

@fightthepower if you're motivated enough, you could make a plugin like I did for clang-format. You could have your plugin put a button in the toolbar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants