mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
create mountpoint_cd command
This commit is contained in:
parent
854f92446a
commit
6cc018cb22
2 changed files with 10 additions and 2 deletions
|
|
@ -195,6 +195,9 @@ keymap = [
|
||||||
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Enter>", run = "mountpoint_cd", desc = "Change directory to selected mountpoint" },
|
||||||
|
{ on = "l", run = "mountpoint_cd", desc = "Change directory to selected mountpoint" },
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
{ on = "~", run = "help", desc = "Open help" },
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
{ on = "<F1>", run = "help", desc = "Open help" },
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
|
use yazi_macro::emit;
|
||||||
use yazi_proxy::options::ProcessExecOpt;
|
use yazi_proxy::options::ProcessExecOpt;
|
||||||
|
use yazi_shared::{Layer, event::Cmd, fs::Url};
|
||||||
|
|
||||||
use crate::mount::Mount;
|
use crate::mount::Mount;
|
||||||
|
|
||||||
impl Mount {
|
impl Mount {
|
||||||
pub fn mountpoint_cd(&mut self, opt: impl TryInto<ProcessExecOpt>) {
|
pub fn mountpoint_cd(&mut self, _opt: impl TryInto<ProcessExecOpt>) {
|
||||||
if let Ok(opt) = opt.try_into() {}
|
if let Some(target) = self.points.get(self.cursor) {
|
||||||
|
let url: Url = target.path.clone().into();
|
||||||
|
emit!(Call(Cmd::args("cd", &[url]), Layer::Manager));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue