mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: Support unyank
There are two options to put the unyank ability: - Option 1: Register a new command like in this CL - Option 2: Add the unyank to the escape sequence, maybe after the escape_select. I chose option 1 because the yank function is its own module but the escape sequence belongs to the tab class. Option 2 is infeasible without touching the module structure. I just randomly choose a meaninful and unoccuped key binding for the `unyank` function. Feel free to modify or remove it from the preset. I personally remap the yank related functions to dance keys such as ["y" "y"].
This commit is contained in:
parent
9d912b07aa
commit
0f73a44847
2 changed files with 6 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ keymap = [
|
|||
{ on = [ "<Enter>" ], exec = "open", desc = "Open the selected files" },
|
||||
{ on = [ "<C-Enter>" ], exec = "open --interactive", desc = "Open the selected files interactively" },
|
||||
{ on = [ "y" ], exec = [ "yank", "escape --visual --select" ], desc = "Copy the selected files" },
|
||||
{ on = [ "Y" ], exec = [ "unyank", "escape --visual --select" ], desc = "Remove the files from the yank clipboard" },
|
||||
{ on = [ "x" ], exec = [ "yank --cut", "escape --visual --select" ], desc = "Cut the selected files" },
|
||||
{ on = [ "p" ], exec = "paste", desc = "Paste the files" },
|
||||
{ on = [ "P" ], exec = "paste --force", desc = "Paste the files (overwrite if the destination exists)" },
|
||||
|
|
|
|||
|
|
@ -18,4 +18,9 @@ impl Manager {
|
|||
self.yanked.1 = self.selected().into_iter().map(|f| f.url()).collect();
|
||||
render!();
|
||||
}
|
||||
|
||||
pub fn unyank(&mut self) -> bool {
|
||||
self.yanked = Default::default();
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue