diff --git a/CHANGELOG.md b/CHANGELOG.md index 37a8226..77ed799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `$_ZO_FZF_OPTS_FILE` to specify configuration file for `fzf` + +### Added + - POSIX: support for non-Cygwin Windows environments (e.g. Busybox). - `import` now supports fetching entries from `atuin`. diff --git a/man/man1/zoxide.1 b/man/man1/zoxide.1 index ef1792b..742c44c 100644 --- a/man/man1/zoxide.1 +++ b/man/man1/zoxide.1 @@ -92,6 +92,10 @@ to use \fBzoxide-remove\fR(1) to remove any existing entries from the database. Custom options to pass to \fBfzf\fR(1) during interactive selection. See the manpage for the full list of options. .TP +.B _ZO_FZF_OPTS_FILE +Path to file containing custom options to pass to \fBfzf\fR(1) during +interactive selection. See the manpage for the full list of options. +.TP .B _ZO_MAXAGE Configures the aging algorithm, which limits the maximum number of entries in the database. By default, this is set to 10000. diff --git a/src/cmd/cmd.rs b/src/cmd/cmd.rs index 0de2ee5..f032ef2 100644 --- a/src/cmd/cmd.rs +++ b/src/cmd/cmd.rs @@ -26,6 +26,7 @@ https://github.com/ajeetdsouza/zoxide {tab}_ZO_ECHO {tab}Print the matched directory before navigating to it when set to 1 {tab}_ZO_EXCLUDE_DIRS {tab}List of directory globs to be excluded {tab}_ZO_FZF_OPTS {tab}Custom flags to pass to fzf +{tab}_ZO_FZF_OPTS_FILE {tab}Path to file containing custom flags to pass to fzf {tab}_ZO_MAXAGE {tab}Maximum total age after which entries start getting deleted {tab}_ZO_RESOLVE_SYMLINKS{tab}Resolve symlinks when storing paths").into_resettable() } diff --git a/src/cmd/query.rs b/src/cmd/query.rs index 6539c2e..1b9f86e 100644 --- a/src/cmd/query.rs +++ b/src/cmd/query.rs @@ -92,6 +92,11 @@ impl Query { fn get_fzf() -> Result { 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 { diff --git a/src/config.rs b/src/config.rs index 0aeda5c..d3e46f7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -47,6 +47,10 @@ pub fn fzf_opts() -> Option { env::var_os("_ZO_FZF_OPTS") } +pub fn fzf_opts_file() -> Option { + env::var_os("_ZO_FZF_OPTS_FILE") +} + pub fn maxage() -> Result { env::var_os("_ZO_MAXAGE").map_or(Ok(10_000.0), |maxage| { let maxage = maxage.to_str().context("invalid unicode in _ZO_MAXAGE")?;