50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From 34ef90c1f4eb33123f975b5a07497e794f5bc57a Mon Sep 17 00:00:00 2001
|
|
From: Artur Manuel <balkenix@outlook.com>
|
|
Date: Mon, 10 Feb 2025 03:18:21 +0000
|
|
Subject: [PATCH] feat(config): add --config flag
|
|
|
|
---
|
|
src/cmd_line.rs | 4 ++++
|
|
src/settings/config.rs | 11 ++++++++++-
|
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/cmd_line.rs b/src/cmd_line.rs
|
|
index f2da7b5..7679383 100644
|
|
--- a/src/cmd_line.rs
|
|
+++ b/src/cmd_line.rs
|
|
@@ -53,6 +53,10 @@ pub struct CmdLineSettings {
|
|
#[arg(long, env = "NEOVIDE_WSL")]
|
|
pub wsl: bool,
|
|
|
|
+ /// Run Neovide with a config path
|
|
+ #[arg(long, env = "NEOVIDE_CONFIG")]
|
|
+ pub config: Option<String>,
|
|
+
|
|
/// Which window decorations to use (do note that the window might not be resizable
|
|
/// if this is "none")
|
|
#[arg(long, env = "NEOVIDE_FRAME", default_value_t)]
|
|
diff --git a/src/settings/config.rs b/src/settings/config.rs
|
|
index 705f046..166095f 100644
|
|
--- a/src/settings/config.rs
|
|
+++ b/src/settings/config.rs
|
|
@@ -28,7 +28,16 @@ fn neovide_config_dir() -> PathBuf {
|
|
}
|
|
|
|
pub fn config_path() -> PathBuf {
|
|
- let mut config_path = neovide_config_dir();
|
|
+ let mut config_path = match env::var("NEOVIDE_CONFIG") {
|
|
+ Ok(val) => PathBuf::from(val),
|
|
+ Err(e) => {
|
|
+ if e != env::VarError::NotPresent {
|
|
+ println!("Not a valid config path! Using default value.");
|
|
+ }
|
|
+
|
|
+ neovide_config_dir()
|
|
+ },
|
|
+ };
|
|
config_path.push(CONFIG_FILE);
|
|
config_path
|
|
}
|
|
--
|
|
2.47.2
|
|
|