Skip to content

Commit 5e687ec

Browse files
krgnpathwave
authored andcommitted
respond to SIGUSR1 by reloading config (helix-editor#3952)
* respond to SIGUSR1 by reloading config * document USR1 signal handling
1 parent 4c002e4 commit 5e687ec

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

book/src/configuration.md

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ hidden = false
2828
You 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
Original file line numberDiff line numberDiff line change
@@ -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
}

0 commit comments

Comments
 (0)