summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs10
-rw-r--r--helix-term/src/commands/typed.rs2
-rw-r--r--helix-term/src/health.rs38
-rw-r--r--helix-term/src/ui/mod.rs8
4 files changed, 36 insertions, 22 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index d56e7c88..c7e93995 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -31,6 +31,7 @@ use crate::{
use log::{debug, error, warn};
use std::{
io::{stdin, stdout},
+ path::Path,
sync::Arc,
time::{Duration, Instant},
};
@@ -113,10 +114,9 @@ impl Application {
use helix_view::editor::Action;
- let theme_loader = std::sync::Arc::new(theme::Loader::new(
- &helix_loader::config_dir(),
- &helix_loader::runtime_dir(),
- ));
+ let mut theme_parent_dirs = vec![helix_loader::config_dir()];
+ theme_parent_dirs.extend(helix_loader::runtime_dirs().iter().cloned());
+ let theme_loader = std::sync::Arc::new(theme::Loader::new(&theme_parent_dirs));
let true_color = config.editor.true_color || crate::true_color();
let theme = config
@@ -162,7 +162,7 @@ impl Application {
compositor.push(editor_view);
if args.load_tutor {
- let path = helix_loader::runtime_dir().join("tutor");
+ let path = helix_loader::runtime_file(Path::new("tutor"));
editor.open(&path, Action::VerticalSplit)?;
// Unset path to prevent accidentally saving to the original tutor file.
doc_mut!(editor).set_path(None)?;
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 5ea61108..e9a72225 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1565,7 +1565,7 @@ fn tutor(
return Ok(());
}
- let path = helix_loader::runtime_dir().join("tutor");
+ let path = helix_loader::runtime_file(Path::new("tutor"));
cx.editor.open(&path, Action::Replace)?;
// Unset path to prevent accidentally saving to the original tutor file.
doc_mut!(cx.editor).set_path(None)?;
diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs
index 6558fe19..480c2c67 100644
--- a/helix-term/src/health.rs
+++ b/helix-term/src/health.rs
@@ -52,7 +52,7 @@ pub fn general() -> std::io::Result<()> {
let config_file = helix_loader::config_file();
let lang_file = helix_loader::lang_config_file();
let log_file = helix_loader::log_file();
- let rt_dir = helix_loader::runtime_dir();
+ let rt_dirs = helix_loader::runtime_dirs();
let clipboard_provider = get_clipboard_provider();
if config_file.exists() {
@@ -66,17 +66,31 @@ pub fn general() -> std::io::Result<()> {
writeln!(stdout, "Language file: default")?;
}
writeln!(stdout, "Log file: {}", log_file.display())?;
- writeln!(stdout, "Runtime directory: {}", rt_dir.display())?;
-
- if let Ok(path) = std::fs::read_link(&rt_dir) {
- let msg = format!("Runtime directory is symlinked to {}", path.display());
- writeln!(stdout, "{}", msg.yellow())?;
- }
- if !rt_dir.exists() {
- writeln!(stdout, "{}", "Runtime directory does not exist.".red())?;
- }
- if rt_dir.read_dir().ok().map(|it| it.count()) == Some(0) {
- writeln!(stdout, "{}", "Runtime directory is empty.".red())?;
+ writeln!(
+ stdout,
+ "Runtime directories: {}",
+ rt_dirs
+ .iter()
+ .map(|d| d.to_string_lossy())
+ .collect::<Vec<_>>()
+ .join(";")
+ )?;
+ for rt_dir in rt_dirs.iter() {
+ if let Ok(path) = std::fs::read_link(rt_dir) {
+ let msg = format!(
+ "Runtime directory {} is symlinked to: {}",
+ rt_dir.display(),
+ path.display()
+ );
+ writeln!(stdout, "{}", msg.yellow())?;
+ }
+ if !rt_dir.exists() {
+ let msg = format!("Runtime directory does not exist: {}", rt_dir.display());
+ writeln!(stdout, "{}", msg.yellow())?;
+ } else if rt_dir.read_dir().ok().map(|it| it.count()) == Some(0) {
+ let msg = format!("Runtime directory is empty: {}", rt_dir.display());
+ writeln!(stdout, "{}", msg.yellow())?;
+ }
}
writeln!(stdout, "Clipboard provider: {}", clipboard_provider.name())?;
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index d7717f8c..3e9a14b0 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -280,10 +280,10 @@ pub mod completers {
}
pub fn theme(_editor: &Editor, input: &str) -> Vec<Completion> {
- let mut names = theme::Loader::read_names(&helix_loader::runtime_dir().join("themes"));
- names.extend(theme::Loader::read_names(
- &helix_loader::config_dir().join("themes"),
- ));
+ let mut names = theme::Loader::read_names(&helix_loader::config_dir().join("themes"));
+ for rt_dir in helix_loader::runtime_dirs() {
+ names.extend(theme::Loader::read_names(&rt_dir.join("themes")));
+ }
names.push("default".into());
names.push("base16_default".into());
names.sort();