mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
5d599167a1
commit
cad0e061eb
6 changed files with 22 additions and 28 deletions
|
|
@ -31,8 +31,8 @@ keymap = [
|
||||||
{ on = [ "<PageUp>" ], exec = "arrow -100%", desc = "Move cursor up one page" },
|
{ on = [ "<PageUp>" ], exec = "arrow -100%", desc = "Move cursor up one page" },
|
||||||
{ on = [ "<PageDown>" ], exec = "arrow 100%", desc = "Move cursor down one page" },
|
{ on = [ "<PageDown>" ], exec = "arrow 100%", desc = "Move cursor down one page" },
|
||||||
|
|
||||||
{ on = [ "h" ], exec = [ "escape --visual", "leave" ], desc = "Go back to the parent directory" },
|
{ on = [ "h" ], exec = "leave", desc = "Go back to the parent directory" },
|
||||||
{ on = [ "l" ], exec = [ "escape --visual", "enter" ], desc = "Enter the child directory" },
|
{ on = [ "l" ], exec = "enter", desc = "Enter the child directory" },
|
||||||
|
|
||||||
{ on = [ "H" ], exec = "back", desc = "Go back to the previous directory" },
|
{ on = [ "H" ], exec = "back", desc = "Go back to the previous directory" },
|
||||||
{ on = [ "L" ], exec = "forward", desc = "Go forward to the next directory" },
|
{ on = [ "L" ], exec = "forward", desc = "Go forward to the next directory" },
|
||||||
|
|
|
||||||
7
yazi-core/src/tab/commands/back.rs
Normal file
7
yazi-core/src/tab/commands/back.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
use yazi_shared::event::Cmd;
|
||||||
|
|
||||||
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
impl Tab {
|
||||||
|
pub fn back(&mut self, _: Cmd) { self.backstack.shift_backward().cloned().map(|u| self.cd(u)); }
|
||||||
|
}
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
use yazi_shared::event::Cmd;
|
|
||||||
|
|
||||||
use crate::tab::Tab;
|
|
||||||
|
|
||||||
pub struct Opt;
|
|
||||||
impl From<()> for Opt {
|
|
||||||
fn from(_: ()) -> Self { Self }
|
|
||||||
}
|
|
||||||
impl From<Cmd> for Opt {
|
|
||||||
fn from(_: Cmd) -> Self { Self }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Tab {
|
|
||||||
pub fn back(&mut self, _: impl Into<Opt>) {
|
|
||||||
if let Some(url) = self.backstack.shift_backward().cloned() {
|
|
||||||
self.cd(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn forward(&mut self, _: impl Into<Opt>) {
|
|
||||||
if let Some(url) = self.backstack.shift_forward().cloned() {
|
|
||||||
self.cd(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -33,6 +33,10 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cd(&mut self, opt: impl Into<Opt>) {
|
pub fn cd(&mut self, opt: impl Into<Opt>) {
|
||||||
|
if !self.try_escape_visual() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let opt = opt.into() as Opt;
|
let opt = opt.into() as Opt;
|
||||||
if opt.interactive {
|
if opt.interactive {
|
||||||
return self.cd_interactive();
|
return self.cd_interactive();
|
||||||
|
|
|
||||||
7
yazi-core/src/tab/commands/forward.rs
Normal file
7
yazi-core/src/tab/commands/forward.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
use yazi_shared::event::Cmd;
|
||||||
|
|
||||||
|
use crate::tab::Tab;
|
||||||
|
|
||||||
|
impl Tab {
|
||||||
|
pub fn forward(&mut self, _: Cmd) { self.backstack.shift_forward().cloned().map(|u| self.cd(u)); }
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
mod arrow;
|
mod arrow;
|
||||||
mod backstack;
|
mod back;
|
||||||
mod cd;
|
mod cd;
|
||||||
mod copy;
|
mod copy;
|
||||||
mod enter;
|
mod enter;
|
||||||
mod escape;
|
mod escape;
|
||||||
mod filter;
|
mod filter;
|
||||||
mod find;
|
mod find;
|
||||||
|
mod forward;
|
||||||
mod hidden;
|
mod hidden;
|
||||||
mod jump;
|
mod jump;
|
||||||
mod leave;
|
mod leave;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue