diff --git a/yazi-core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs index 69b59e29..672cf46c 100644 --- a/yazi-core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -26,7 +26,7 @@ impl From for Opt { impl From for Opt { fn from(mut target: Url) -> Self { - if target.is_regular() { + if target.is_regular() && target.to_string() != "-" { target = Url::from(expand_path(&target)); } Self { target, interactive: false } @@ -48,6 +48,15 @@ impl Tab { return; } + if opt.target.to_string() == "-" { + if let Some(last_cwd) = self.backstack.shift_backward() { + TabProxy::cd(&last_cwd); + } + + self.backstack.push(self.cwd().clone()); + return; + } + // Take parent to history if let Some(rep) = self.parent.take() { self.history.insert(rep.url.to_owned(), rep);