|
|
|
@ -20,6 +20,8 @@ static COMMAND_HISTFILE: once_cell::sync::OnceCell<PathBuf> = once_cell::sync::O
|
|
|
|
|
|
|
|
|
|
static SEARCH_HISTFILE: once_cell::sync::OnceCell<PathBuf> = once_cell::sync::OnceCell::new();
|
|
|
|
|
|
|
|
|
|
static FILE_HISTFILE: once_cell::sync::OnceCell<PathBuf> = once_cell::sync::OnceCell::new();
|
|
|
|
|
|
|
|
|
|
pub fn initialize_config_file(specified_file: Option<PathBuf>) {
|
|
|
|
|
let config_file = specified_file.unwrap_or_else(default_config_file);
|
|
|
|
|
ensure_parent_dir(&config_file);
|
|
|
|
@ -44,6 +46,12 @@ pub fn initialize_search_histfile(specified_file: Option<PathBuf>) {
|
|
|
|
|
SEARCH_HISTFILE.set(search_histfile).ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn initialize_file_histfile(specified_file: Option<PathBuf>) {
|
|
|
|
|
let file_histfile = specified_file.unwrap_or_else(default_file_histfile);
|
|
|
|
|
ensure_parent_dir(&file_histfile);
|
|
|
|
|
FILE_HISTFILE.set(file_histfile).ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A list of runtime directories from highest to lowest priority
|
|
|
|
|
///
|
|
|
|
|
/// The priority is:
|
|
|
|
@ -179,6 +187,10 @@ pub fn search_histfile() -> PathBuf {
|
|
|
|
|
.unwrap()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn file_histfile() -> PathBuf {
|
|
|
|
|
FILE_HISTFILE.get().map(|path| path.to_path_buf()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn workspace_config_file() -> PathBuf {
|
|
|
|
|
find_workspace().0.join(".helix").join("config.toml")
|
|
|
|
|
}
|
|
|
|
@ -199,6 +211,10 @@ pub fn default_search_histfile() -> PathBuf {
|
|
|
|
|
state_dir().join("search_history")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn default_file_histfile() -> PathBuf {
|
|
|
|
|
state_dir().join("file_history")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Merge two TOML documents, merging values from `right` onto `left`
|
|
|
|
|
///
|
|
|
|
|
/// When an array exists in both `left` and `right`, `right`'s array is
|
|
|
|
|