49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
From 02d68470c717b6e076566555af4978762d3588ad Mon Sep 17 00:00:00 2001
|
|
From: Artur Manuel <balkenix@outlook.com>
|
|
Date: Tue, 11 Feb 2025 16:42:07 +0000
|
|
Subject: [PATCH] feat(env): add NEOVIDE_CONFIG env var
|
|
|
|
---
|
|
src/settings/config.rs | 12 +++++++++---
|
|
website/docs/config-file.md | 2 ++
|
|
2 files changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/settings/config.rs b/src/settings/config.rs
|
|
index 705f046..db8d910 100644
|
|
--- a/src/settings/config.rs
|
|
+++ b/src/settings/config.rs
|
|
@@ -28,9 +28,15 @@ fn neovide_config_dir() -> PathBuf {
|
|
}
|
|
|
|
pub fn config_path() -> PathBuf {
|
|
- let mut config_path = neovide_config_dir();
|
|
- config_path.push(CONFIG_FILE);
|
|
- config_path
|
|
+ env::var("NEOVIDE_CONFIG")
|
|
+ .ok()
|
|
+ .map(PathBuf::from)
|
|
+ .filter(|path| path.exists() && path.is_file())
|
|
+ .unwrap_or_else(|| {
|
|
+ let mut path = neovide_config_dir();
|
|
+ path.push(CONFIG_FILE);
|
|
+ path
|
|
+ })
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Default, Clone)]
|
|
diff --git a/website/docs/config-file.md b/website/docs/config-file.md
|
|
index bd877ae..6b609ef 100644
|
|
--- a/website/docs/config-file.md
|
|
+++ b/website/docs/config-file.md
|
|
@@ -20,6 +20,8 @@ There are two types of settings:
|
|
| macOS | `$XDG_CONFIG_HOME/neovide/config.toml` or `$HOME/.config/neovide/config.toml` | `/Users/Alice/Library/Application Support/neovide/config.toml` |
|
|
| Windows | `{FOLDERID_RoamingAppData}/neovide/config.toml` | `C:\Users\Alice\AppData\Roaming/neovide/config.toml` |
|
|
|
|
+You may use a different location by modifying the `$NEOVIDE_CONFIG`.
|
|
+
|
|
## Available settings
|
|
|
|
Settings currently available in the config file with default values:
|
|
--
|
|
2.48.1
|
|
|