mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: open support enter dir (#2)
This commit is contained in:
parent
b6ea235b5e
commit
f6547dd051
3 changed files with 18 additions and 2 deletions
|
|
@ -21,7 +21,8 @@ keymap = [
|
||||||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||||
{ on = [ "<Left>" ], exec = "leave" },
|
{ on = [ "<Left>" ], exec = "leave" },
|
||||||
{ on = [ "<Right>" ], exec = "enter" },
|
{ on = [ "<Right>" ], exec = "open" },
|
||||||
|
{ on = [ "<C-Right>" ], exec = "open --select" },
|
||||||
|
|
||||||
# Selection
|
# Selection
|
||||||
{ on = [ "<Space>" ], exec = "select --state=none" },
|
{ on = [ "<Space>" ], exec = "select --state=none" },
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,16 @@ impl Tab {
|
||||||
};
|
};
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn current_is_dir(&self) -> bool{
|
||||||
|
let hovered = if let Some(ref h) = self.current.hovered {
|
||||||
|
h.clone()
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
hovered.meta.is_dir()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,12 @@ impl Executor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operation
|
// Operation
|
||||||
"open" => cx.manager.open(exec.named.contains_key("select")),
|
"open" => {
|
||||||
|
if cx.manager.active().current_is_dir() {
|
||||||
|
return cx.manager.active_mut().enter();
|
||||||
|
}
|
||||||
|
cx.manager.open(exec.named.contains_key("select"))
|
||||||
|
},
|
||||||
"yank" => cx.manager.yank(exec.named.contains_key("cut")),
|
"yank" => cx.manager.yank(exec.named.contains_key("cut")),
|
||||||
"paste" => {
|
"paste" => {
|
||||||
let dest = cx.manager.current().cwd.clone();
|
let dest = cx.manager.current().cwd.clone();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue