Merge 7936aa6f4c into c8a47a068b
This commit is contained in:
commit
4d2e4a01c6
|
|
@ -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
|
Custom options to pass to \fBfzf\fR(1) during interactive selection. See the
|
||||||
manpage for the full list of options.
|
manpage for the full list of options.
|
||||||
.TP
|
.TP
|
||||||
|
.B_ZO_FZF_EXTRA_OPTS
|
||||||
|
Custom options to pass to \fBfzf\fR(1) during interactive selection, appended to the default ones.
|
||||||
|
See the manpage for the full list of options.
|
||||||
|
.TP
|
||||||
.B _ZO_MAXAGE
|
.B _ZO_MAXAGE
|
||||||
Configures the aging algorithm, which limits the maximum number of entries in
|
Configures the aging algorithm, which limits the maximum number of entries in
|
||||||
the database. By default, this is set to 10000.
|
the database. By default, this is set to 10000.
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ https://github.com/ajeetdsouza/zoxide
|
||||||
{tab}<bold>_ZO_ECHO</bold> {tab}Print the matched directory before navigating to it when set to 1
|
{tab}<bold>_ZO_ECHO</bold> {tab}Print the matched directory before navigating to it when set to 1
|
||||||
{tab}<bold>_ZO_EXCLUDE_DIRS</bold> {tab}List of directory globs to be excluded
|
{tab}<bold>_ZO_EXCLUDE_DIRS</bold> {tab}List of directory globs to be excluded
|
||||||
{tab}<bold>_ZO_FZF_OPTS</bold> {tab}Custom flags to pass to fzf
|
{tab}<bold>_ZO_FZF_OPTS</bold> {tab}Custom flags to pass to fzf
|
||||||
|
{tab}<bold>_ZO_FZF_EXTRA_OPTS</bold> {tab}Custom flags added the the default fzf ones
|
||||||
{tab}<bold>_ZO_MAXAGE</bold> {tab}Maximum total age after which entries start getting deleted
|
{tab}<bold>_ZO_MAXAGE</bold> {tab}Maximum total age after which entries start getting deleted
|
||||||
{tab}<bold>_ZO_RESOLVE_SYMLINKS</bold>{tab}Resolve symlinks when storing paths").into_resettable()
|
{tab}<bold>_ZO_RESOLVE_SYMLINKS</bold>{tab}Resolve symlinks when storing paths").into_resettable()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,29 +92,35 @@ impl Query {
|
||||||
|
|
||||||
fn get_fzf() -> Result<FzfChild> {
|
fn get_fzf() -> Result<FzfChild> {
|
||||||
let mut fzf = Fzf::new()?;
|
let mut fzf = Fzf::new()?;
|
||||||
if let Some(fzf_opts) = config::fzf_opts() {
|
|
||||||
fzf.env("FZF_DEFAULT_OPTS", fzf_opts)
|
match config::fzf_opts() {
|
||||||
} else {
|
Some(mut fzf_opts) => {
|
||||||
fzf.args([
|
if let Some(fzf_extra_opts) = config::fzf_extra_opts() {
|
||||||
// Search mode
|
fzf_opts.push(" ");
|
||||||
"--exact",
|
fzf_opts.push(fzf_extra_opts);
|
||||||
// Search result
|
}
|
||||||
"--no-sort",
|
|
||||||
// Interface
|
fzf.env("FZF_DEFAULT_OPTS", fzf_opts)
|
||||||
"--bind=ctrl-z:ignore,btab:up,tab:down",
|
}
|
||||||
"--cycle",
|
None => {
|
||||||
"--keep-right",
|
let default_args = config::fzf_default_args();
|
||||||
// Layout
|
|
||||||
"--border=sharp", // rounded edges don't display correctly on some terminals
|
let args = match config::fzf_extra_opts() {
|
||||||
"--height=45%",
|
Some(fzf_extra_opts) => {
|
||||||
"--info=inline",
|
let extra_fzf_args_list: Vec<String> = fzf_extra_opts
|
||||||
"--layout=reverse",
|
.to_str()
|
||||||
// Display
|
.unwrap_or_default()
|
||||||
"--tabstop=1",
|
.split_whitespace()
|
||||||
// Scripting
|
.map(|arg| String::from(arg))
|
||||||
"--exit-0",
|
.collect();
|
||||||
])
|
|
||||||
.enable_preview()
|
vec![default_args, extra_fzf_args_list].concat()
|
||||||
|
}
|
||||||
|
None => default_args,
|
||||||
|
};
|
||||||
|
|
||||||
|
fzf.args(args).enable_preview()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.spawn()
|
.spawn()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,32 @@ pub fn fzf_opts() -> Option<OsString> {
|
||||||
env::var_os("_ZO_FZF_OPTS")
|
env::var_os("_ZO_FZF_OPTS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn fzf_extra_opts() -> Option<OsString> {
|
||||||
|
env::var_os("_ZO_FZF_EXTRA_OPTS")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fzf_default_args() -> Vec<String> {
|
||||||
|
vec![
|
||||||
|
// Search mode
|
||||||
|
String::from("--exact"),
|
||||||
|
// Search result
|
||||||
|
String::from("--no-sort"),
|
||||||
|
// Interface
|
||||||
|
String::from("--bind=ctrl-z:ignore,btab:up,tab:down"),
|
||||||
|
String::from("--cycle"),
|
||||||
|
String::from("--keep-right"),
|
||||||
|
// Layout
|
||||||
|
String::from("--border=sharp"), // rounded edges don't display correctly on some terminals
|
||||||
|
String::from("--height=45%"),
|
||||||
|
String::from("--info=inline"),
|
||||||
|
String::from("--layout=reverse"),
|
||||||
|
// Display
|
||||||
|
String::from("--tabstop=1"),
|
||||||
|
// Scripting
|
||||||
|
String::from("--exit-0"),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
pub fn maxage() -> Result<Rank> {
|
pub fn maxage() -> Result<Rank> {
|
||||||
env::var_os("_ZO_MAXAGE").map_or(Ok(10_000.0), |maxage| {
|
env::var_os("_ZO_MAXAGE").map_or(Ok(10_000.0), |maxage| {
|
||||||
let maxage = maxage.to_str().context("invalid unicode in _ZO_MAXAGE")?;
|
let maxage = maxage.to_str().context("invalid unicode in _ZO_MAXAGE")?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue