From bc4e54c0c45abbbb5fe9ac3278361d0b4e5774ba Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 7 Apr 2021 23:56:20 +0900 Subject: Load config files from ~/.config/helix, fallback to defaults. --- helix-core/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'helix-core/src') 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; -- cgit v1.2.3-70-g09d2