Skip to content

Commit

Permalink
create mountpoint_cd command
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutsay Aleksandr Valeryevich committed Nov 30, 2024
1 parent 854f924 commit 6cc018c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions yazi-config/preset/keymap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ keymap = [
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ 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
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
Expand Down
9 changes: 7 additions & 2 deletions yazi-core/src/mount/commands/mountpoint_cd.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
use yazi_macro::emit;
use yazi_proxy::options::ProcessExecOpt;
use yazi_shared::{Layer, event::Cmd, fs::Url};

use crate::mount::Mount;

impl Mount {
pub fn mountpoint_cd(&mut self, opt: impl TryInto<ProcessExecOpt>) {
if let Ok(opt) = opt.try_into() {}
pub fn mountpoint_cd(&mut self, _opt: impl TryInto<ProcessExecOpt>) {
if let Some(target) = self.points.get(self.cursor) {
let url: Url = target.path.clone().into();
emit!(Call(Cmd::args("cd", &[url]), Layer::Manager));
}
}
}

0 comments on commit 6cc018c

Please sign in to comment.