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.
https://github.com/geany/geany/issues/2587#issuecomment-693729855
Can you give me a simple example for that. I really don't get the piping method.
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 <kbd>Ctrl</kbd>+<kbd>a</kbd> <kbd>Ctrl</kbd>+<kbd>1</kbd> would format the entire current document.
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.
@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.
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.
Closed #2603.
@fightthepower if you're motivated enough, you could make [a plugin like I did](https://github.com/codebrainz/code-format/) for clang-format. You could have your plugin put a button in the toolbar.
github-comments@lists.geany.org