diff --git a/docs/configuration.markdown b/docs/configuration.markdown index 3dea1a442..a40247e26 100644 --- a/docs/configuration.markdown +++ b/docs/configuration.markdown @@ -7,6 +7,8 @@ title: Configuration `wezterm` will look for a TOML configuration file in the following locations, stopping at the first file that it finds: +* If the environment variable `$WEZTERM_CONFIG_FILE` is set, it will be treated as the + path to a configuration file. * On Windows, `wezterm.toml` from the directory that contains `wezterm.exe`. This is handy for users that want to carry their wezterm install around on a thumb drive. * `$HOME/.config/wezterm/wezterm.toml`, diff --git a/src/config/mod.rs b/src/config/mod.rs index e7c21aee4..4182a3bbb 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -537,6 +537,9 @@ impl Config { } } } + if let Some(path) = std::env::var_os("WEZTERM_CONFIG_FILE") { + paths.insert(0, path.into()); + } for p in &paths { log::trace!("consider config: {}", p.display());