summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs3
-rw-r--r--helix-term/src/args.rs5
-rw-r--r--helix-term/src/main.rs6
3 files changed, 10 insertions, 4 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 50e72cf7..527ca1c7 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -89,9 +89,8 @@ impl Application {
use helix_view::editor::Action;
- let config_dir = helix_loader::config_dir();
let theme_loader = std::sync::Arc::new(theme::Loader::new(
- &config_dir,
+ &helix_loader::config_dir(),
&helix_loader::runtime_dir(),
));
diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs
index c3019ea7..d16d7dfd 100644
--- a/helix-term/src/args.rs
+++ b/helix-term/src/args.rs
@@ -14,6 +14,7 @@ pub struct Args {
pub build_grammars: bool,
pub split: Option<Layout>,
pub verbosity: u64,
+ pub config_file: Option<PathBuf>,
pub files: Vec<(PathBuf, Position)>,
}
@@ -43,6 +44,10 @@ impl Args {
anyhow::bail!("--grammar must be followed by either 'fetch' or 'build'")
}
},
+ "-c" | "--config" => match argv.next().as_deref() {
+ Some(path) => args.config_file = Some(path.into()),
+ None => anyhow::bail!("--config must specify a path to read"),
+ },
arg if arg.starts_with("--") => {
anyhow::bail!("unexpected double dash argument: {}", arg)
}
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 83af7588..7f04f201 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -64,6 +64,7 @@ FLAGS:
--health [LANG] Checks for potential errors in editor setup
If given, checks for config errors in language LANG
-g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
+ -c, --config <file> Specifies a file to use for configuration
-v Increases logging verbosity each use for up to 3 times
(default file: {})
-V, --version Prints version information
@@ -119,14 +120,15 @@ FLAGS:
std::fs::create_dir_all(&config_dir).ok();
}
- let config = match std::fs::read_to_string(config_dir.join("config.toml")) {
+ helix_loader::initialize_config_file(args.config_file.clone());
+
+ let config = match std::fs::read_to_string(helix_loader::config_file()) {
Ok(config) => toml::from_str(&config)
.map(helix_term::keymap::merge_keys)
.unwrap_or_else(|err| {
eprintln!("Bad config: {}", err);
eprintln!("Press <ENTER> to continue with default config");
use std::io::Read;
- // This waits for an enter press.
let _ = std::io::stdin().read(&mut []);
Config::default()
}),