Add _ZO_FZF_OPTS_FILE environment variable

zoxide now recognizes `_ZO_FZF_OPTS_FILE` environment variable, in
addition to `_ZO_FZF_OPTS`.
This commit is contained in:
Aiden Ghim 2026-04-04 18:00:49 +09:00
parent 67ca1bc959
commit a96dc1aa41
2 changed files with 10 additions and 0 deletions

View File

@ -92,6 +92,11 @@ impl Query {
fn get_fzf() -> Result<FzfChild> {
let mut fzf = Fzf::new()?;
if let Some(fzf_opts_file) = config::fzf_opts_file() {
fzf.env("FZF_DEFAULT_OPTS_FILE", fzf_opts_file);
}
if let Some(fzf_opts) = config::fzf_opts() {
fzf.env("FZF_DEFAULT_OPTS", fzf_opts)
} else {

View File

@ -47,6 +47,11 @@ pub fn fzf_opts() -> Option<OsString> {
env::var_os("_ZO_FZF_OPTS")
}
pub fn fzf_opts_file() -> Option<OsString> {
env::var_os("_ZO_FZF_OPTS_FILE")
}
pub fn maxage() -> Result<Rank> {
env::var_os("_ZO_MAXAGE").map_or(Ok(10_000.0), |maxage| {
let maxage = maxage.to_str().context("invalid unicode in _ZO_MAXAGE")?;