diff options
author | Blaž Hrastnik | 2021-04-07 14:56:20 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-04-07 14:56:20 +0000 |
commit | bc4e54c0c45abbbb5fe9ac3278361d0b4e5774ba (patch) | |
tree | a37eafc76b3b2fd19415761eac0eb97b437f261b /helix-core | |
parent | f0d49d3ca4535a8c22a4ca4038e889560723ec74 (diff) |
Load config files from ~/.config/helix, fallback to defaults.
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/Cargo.toml | 2 | ||||
-rw-r--r-- | helix-core/src/lib.rs | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index d95c0f47..4b1566d7 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -21,3 +21,5 @@ once_cell = "1.4" regex = "1" serde = { version = "1.0", features = ["derive"] } + +xdg = "2.0" diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index b3ce3c47..dda9863b 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -44,6 +44,13 @@ pub(crate) fn find_first_non_whitespace_char(text: RopeSlice, line_num: usize) - None } +pub fn config_dir() -> std::path::PathBuf { + // TODO: allow env var override + let xdg_dirs = + xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!"); + xdg_dirs.get_config_home() +} + pub use ropey::{Rope, RopeSlice}; pub use tendril::StrTendril as Tendril; |