Allows using NEOVIDE_WSL or config file to set wsl (#1942)

* Allow using env var or config file for setting wsl

* add wsl option in config doc
This commit is contained in:
Ricky12Awesome 2023-07-24 05:21:46 -05:00 committed by GitHub
parent eeac6e76fc
commit 3dee458ee4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View file

@ -45,7 +45,7 @@ pub struct CmdLineSettings {
pub server: Option<String>,
/// Run NeoVim in WSL rather than on the host
#[arg(long)]
#[arg(long, env = "NEOVIDE_WSL")]
pub wsl: bool,
/// Which window decorations to use (do note that the window might not be resizable

View file

@ -31,6 +31,7 @@ pub fn config_path() -> PathBuf {
#[derive(Debug, Deserialize, Default)]
pub struct Config {
pub wsl: Option<bool>,
pub multigrid: Option<bool>,
pub maximized: Option<bool>,
pub vsync: Option<bool>,
@ -52,6 +53,9 @@ impl Config {
}
fn write_to_env(&self) {
if let Some(wsl) = self.wsl {
env::set_var("NEOVIDE_WSL", wsl.to_string());
}
if let Some(multigrid) = self.multigrid {
env::set_var("NEOVIDE_MULTIGRID", multigrid.to_string());
}

View file

@ -22,6 +22,7 @@ overridden by command line arguments.
Settings currently available in the config file with default values:
```toml
wsl = false
multigrid = false
vsync = true
maximized = false