diff options
author | Ivan Tham | 2021-06-22 17:04:04 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-24 15:39:03 +0000 |
commit | 10548bf0e32209e02460021cc8ca4865c4c75bf7 (patch) | |
tree | bed9421daebdf404ce833d797e32e2c1f515a041 /helix-term/src/main.rs | |
parent | 15ae2e7ef1a7c33733c999e9018cca22cdae1da9 (diff) |
Fix previous broken refactor key into helix-view
Need to be used for autoinfo
Revert "Revert "Refactor key into helix-view""
This reverts commit 10f9f72232f5789323d689bf0f9cd359715770d6.
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r-- | helix-term/src/main.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 506e49ce..180dacd1 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -1,10 +1,10 @@ +use anyhow::{Context, Error, Result}; use helix_term::application::Application; use helix_term::args::Args; use helix_term::config::Config; +use helix_term::keymap::merge_keys; use std::path::PathBuf; -use anyhow::{Context, Result}; - fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> { let mut base_config = fern::Dispatch::new(); @@ -84,12 +84,11 @@ FLAGS: std::fs::create_dir_all(&conf_dir).ok(); } - let config = std::fs::read_to_string(conf_dir.join("config.toml")) - .ok() - .map(|s| toml::from_str(&s)) - .transpose()? - .or_else(|| Some(Config::default())) - .unwrap(); + let config = match std::fs::read_to_string(conf_dir.join("config.toml")) { + Ok(config) => merge_keys(toml::from_str(&config)?), + Err(err) if err.kind() == std::io::ErrorKind::NotFound => Config::default(), + Err(err) => return Err(Error::new(err)), + }; setup_logging(logpath, args.verbosity).context("failed to initialize logging")?; |