mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: open support open dir
This commit is contained in:
parent
dfa338500c
commit
a75f307cc7
3 changed files with 11 additions and 14 deletions
|
|
@ -21,8 +21,8 @@ keymap = [
|
|||
{ on = [ "<Up>" ], exec = "arrow -1" },
|
||||
{ on = [ "<Down>" ], exec = "arrow 1" },
|
||||
{ on = [ "<Left>" ], exec = "leave" },
|
||||
{ on = [ "<Right>" ], exec = "enter" },
|
||||
{ on = [ "<C-Right>" ], exec = "enter --select" },
|
||||
{ on = [ "<Right>" ], exec = "open" },
|
||||
{ on = [ "<C-Right>" ], exec = "open --select" },
|
||||
|
||||
# Selection
|
||||
{ on = [ "<Space>" ], exec = "select --state=none" },
|
||||
|
|
|
|||
|
|
@ -263,17 +263,14 @@ impl Tab {
|
|||
true
|
||||
}
|
||||
|
||||
pub fn current_is_file(&self) -> bool{
|
||||
pub fn current_is_dir(&self) -> bool{
|
||||
let hovered = if let Some(ref h) = self.current.hovered {
|
||||
h.clone()
|
||||
} else {
|
||||
return false;
|
||||
};
|
||||
|
||||
if hovered.meta.is_dir() {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
hovered.meta.is_dir()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,12 +62,7 @@ impl Executor {
|
|||
cx.manager.active_mut().arrow(step)
|
||||
}
|
||||
"leave" => cx.manager.active_mut().leave(),
|
||||
"enter" =>{
|
||||
if cx.manager.active().current_is_file() {
|
||||
return cx.manager.open(exec.named.contains_key("select"))
|
||||
}
|
||||
cx.manager.active_mut().enter()
|
||||
},
|
||||
"enter" => cx.manager.active_mut().enter(),
|
||||
"back" => cx.manager.active_mut().back(),
|
||||
"forward" => cx.manager.active_mut().forward(),
|
||||
|
||||
|
|
@ -83,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…
Add table
Reference in a new issue