summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyohei Uto <im@kyoheiu.dev>2023-08-23 17:45:59 +0900
committerKyohei Uto <im@kyoheiu.dev>2023-08-23 17:45:59 +0900
commitb83ad88996842fdea9f4620cca52e24328adfc59 (patch)
tree8ca44dba86714eedc4cf971be5733678a9dc4b8e
parent1a9b3a4e090857b845021b4c68da850dc4bf51e3 (diff)
Execute `zoxide add` when chdir (if zoxide is installed)
-rw-r--r--src/state.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/state.rs b/src/state.rs
index bbd45db..0de5196 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -1544,6 +1544,18 @@ impl State {
self.reload(BEGINNING_ROW)?;
}
}
+ //if zoxide is installed, add the target or increment its rank.
+ if self.has_zoxide {
+ if let Some(p) = p.as_os_str().to_str() {
+ if std::process::Command::new("zoxide")
+ .args(["add", p])
+ .output()
+ .is_err()
+ {
+ print_warning("Failed to `zoxide add`.", self.layout.y);
+ }
+ }
+ }
self.v_start = None;
Ok(())
}