mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: enter support open file
This commit is contained in:
parent
b6ea235b5e
commit
438406f48d
3 changed files with 19 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ keymap = [
|
||||||
{ 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 = "enter" },
|
||||||
|
{ on = [ "<C-Right>" ], exec = "enter --select" },
|
||||||
|
|
||||||
# Selection
|
# Selection
|
||||||
{ on = [ "<Space>" ], exec = "select --state=none" },
|
{ on = [ "<Space>" ], exec = "select --state=none" },
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,18 @@ impl Tab {
|
||||||
};
|
};
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn current_is_file(&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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,12 @@ impl Executor {
|
||||||
cx.manager.active_mut().arrow(step)
|
cx.manager.active_mut().arrow(step)
|
||||||
}
|
}
|
||||||
"leave" => cx.manager.active_mut().leave(),
|
"leave" => cx.manager.active_mut().leave(),
|
||||||
"enter" => cx.manager.active_mut().enter(),
|
"enter" =>{
|
||||||
|
if cx.manager.active().current_is_file() {
|
||||||
|
return cx.manager.open(exec.named.contains_key("select"))
|
||||||
|
}
|
||||||
|
cx.manager.active_mut().enter()
|
||||||
|
},
|
||||||
"back" => cx.manager.active_mut().back(),
|
"back" => cx.manager.active_mut().back(),
|
||||||
"forward" => cx.manager.active_mut().forward(),
|
"forward" => cx.manager.active_mut().forward(),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue