aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarsten Gebbert2022-10-03 15:08:32 +0000
committerGitHub2022-10-03 15:08:32 +0000
commit9124c231f426318e970c62647c1ddabed3c9a389 (patch)
tree5ac3abc4af2bb18dab20756d8ad570b2dc23578d
parent3d59d3f8be214ddb5b75d6a9df5f0ea1fff5f31c (diff)
respond to SIGUSR1 by reloading config (#3952)
* respond to SIGUSR1 by reloading config * document USR1 signal handling
-rw-r--r--book/src/configuration.md4
-rw-r--r--helix-term/src/application.rs8
2 files changed, 10 insertions, 2 deletions
diff --git a/book/src/configuration.md b/book/src/configuration.md
index 276bd7d4..a5092b9d 100644
--- a/book/src/configuration.md
+++ b/book/src/configuration.md
@@ -28,6 +28,10 @@ hidden = false
You may also specify a file to use for configuration with the `-c` or
`--config` CLI argument: `hx -c path/to/custom-config.toml`.
+It is also possible to trigger configuration file reloading by sending the `USR1`
+signal to the helix process, e.g. via `pkill -USR1 hx`. This is only supported
+on unix operating systems.
+
## Editor
### `[editor]` Section
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index cd499f1c..ee0e08ef 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -224,8 +224,8 @@ impl Application {
#[cfg(windows)]
let signals = futures_util::stream::empty();
#[cfg(not(windows))]
- let signals =
- Signals::new(&[signal::SIGTSTP, signal::SIGCONT]).context("build signal handler")?;
+ let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1])
+ .context("build signal handler")?;
let app = Self {
compositor,
@@ -426,6 +426,10 @@ impl Application {
self.compositor.load_cursor();
self.render();
}
+ signal::SIGUSR1 => {
+ self.refresh_config();
+ self.render();
+ }
_ => unreachable!(),
}
}