aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/main.rs
diff options
context:
space:
mode:
authorPabloMansanet2021-06-17 11:08:05 +0000
committerGitHub2021-06-17 11:08:05 +0000
commitf7e00cf720f55ea82933ac6625b7511e9d38139e (patch)
treedc8278b34332eebea8b137d15cca9e5fb08b2b06 /helix-term/src/main.rs
parent47d2e3aefa5d31c19e7def624057a29c4bc7bc41 (diff)
Configurable keys 2 (Mapping keys to commands) (#268)
* Add convenience/clarity wrapper for Range initialization * Add keycode parse and display methods * Add remapping functions and tests * Implement key remapping * Add remapping book entry * Use raw string literal for toml * Add command constants * Make command functions private * Map directly to commands * Match key parsing/displaying to Kakoune * Formatting pass * Update documentation * Formatting * Fix example in the book * Refactor into single config file * Formatting * Refactor configuration and add keymap newtype wrappers * Address first batch of PR comments * Replace FromStr with custom deserialize
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r--helix-term/src/main.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 9d4e1c5b..ef912480 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -1,6 +1,6 @@
use helix_term::application::Application;
use helix_term::args::Args;
-
+use helix_term::config::Config;
use std::path::PathBuf;
use anyhow::{Context, Result};
@@ -89,10 +89,17 @@ 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();
+
setup_logging(logpath, args.verbosity).context("failed to initialize logging")?;
// TODO: use the thread local executor to spawn the application task separately from the work pool
- let mut app = Application::new(args).context("unable to create new appliction")?;
+ let mut app = Application::new(args, config).context("unable to create new application")?;
app.run().await.unwrap();
Ok(())