on master help sign in
respond to SIGUSR1 by reloading config (#3952)

* respond to SIGUSR1 by reloading config * document USR1 signal handling

commit9124c231f426318e970c62647c1ddabed3c9a389 authorKarsten Gebbert <k@ioctl.it> dateMon 3 Oct 2022, 17:08 (4 years ago) parent3d59d3f
2 files changed+10−2
book/src/configuration.md+4 helix-term/src/application.rs+6−2
book/src/configuration.md+4
@@ -28,6 +28,10 @@ hidden = false
2828You may also specify a file to use for configuration with the `-c` or
2929`--config` CLI argument: `hx -c path/to/custom-config.toml`.
3030
31+It is also possible to trigger configuration file reloading by sending the `USR1`
32+signal to the helix process, e.g. via `pkill -USR1 hx`. This is only supported
33+on unix operating systems.
34+
3135## Editor
3236
3337### `[editor]` Section
helix-term/src/application.rs+6−2
@@ -224,8 +224,8 @@ impl Application {
224224 #[cfg(windows)]
225225 let signals = futures_util::stream::empty();
226226 #[cfg(not(windows))]
227− let signals =
228− Signals::new(&[signal::SIGTSTP, signal::SIGCONT]).context("build signal handler")?;
227+ let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
228+ .context("build signal handler")?;
229229
230230 let app = Self {
231231 compositor,
@@ -426,6 +426,10 @@ impl Application {
426426 self.compositor.load_cursor();
427427 self.render();
428428 }
429+ signal::SIGUSR1 => {
430+ self.refresh_config();
431+ self.render();
432+ }
429433 _ => unreachable!(),
430434 }
431435 }