aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-07 14:56:20 +0000
committerBlaž Hrastnik2021-04-07 14:56:20 +0000
commitbc4e54c0c45abbbb5fe9ac3278361d0b4e5774ba (patch)
treea37eafc76b3b2fd19415761eac0eb97b437f261b /helix-view/src
parentf0d49d3ca4535a8c22a4ca4038e889560723ec74 (diff)
Load config files from ~/.config/helix, fallback to defaults.
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 531571f7..0eab4fe7 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -25,9 +25,13 @@ pub enum Action {
impl Editor {
pub fn new(executor: &'static smol::Executor<'static>, mut area: tui::layout::Rect) -> Self {
- // TODO: load from config dir
- let toml = include_str!("../../theme.toml");
- let theme: Theme = toml::from_str(&toml).expect("failed to parse theme.toml");
+ use helix_core::config_dir;
+ let config = std::fs::read(config_dir().join("theme.toml"));
+ // load $HOME/.config/helix/theme.toml, fallback to default config
+ let toml = config
+ .as_deref()
+ .unwrap_or(include_bytes!("../../theme.toml"));
+ let theme: Theme = toml::from_slice(&toml).expect("failed to parse theme.toml");
let language_servers = helix_lsp::Registry::new();