mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-18 22:31:35 +03:00
feat: open
support enter dir (#2)
This commit is contained in:
parent
b6ea235b5e
commit
f6547dd051
@ -21,7 +21,8 @@ keymap = [
|
||||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||
{ on = [ "<Left>" ], exec = "leave" },
|
||||
{ on = [ "<Right>" ], exec = "enter" },
|
||||
{ on = [ "<Right>" ], exec = "open" },
|
||||
{ on = [ "<C-Right>" ], exec = "open --select" },
|
||||
|
||||
# Selection
|
||||
{ on = [ "<Space>" ], exec = "select --state=none" },
|
||||
|
@ -262,6 +262,16 @@ impl Tab {
|
||||
};
|
||||
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 {
|
||||
|
@ -78,7 +78,12 @@ impl Executor {
|
||||
}
|
||||
|
||||
// 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")),
|
||||
"paste" => {
|
||||
let dest = cx.manager.current().cwd.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user