diff --git a/README.md b/README.md index 9e78a17e..5ae75e2e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +## The main branch is the upcoming v0.4 development version. Please see [the `shipped` tag](https://github.com/sxyazi/yazi/tree/shipped) for the stable version of Yazi. + +For breaking changes, see [Migrating to Yazi v0.4.0](https://github.com/sxyazi/yazi/issues/1772). +
Yazi logo
@@ -16,7 +20,7 @@ Yazi (means "duck") is a terminal file manager written in Rust, based on non-blo - 📡 **Data Distribution Service**: Built on a client-server architecture (no additional server process required), integrated with a Lua-based publish-subscribe model, achieving cross-instance communication and state persistence. - 📦 **Package Manager**: Install plugins and themes with one command, keeping them up to date, or pin them to a specific version. - 🧰 Integration with ripgrep, fd, fzf, zoxide -- 💫 Vim-like input/select/confirm/which/notify component, auto-completion for cd paths +- 💫 Vim-like input/pick/confirm/which/notify component, auto-completion for cd paths - 🏷️ Multi-Tab Support, Cross-directory selection, Scrollable Preview (for videos, PDFs, archives, directories, code, etc.) - 🔄 Bulk Renaming, Visual Mode, File Chooser - 🎨 Theme System, Mouse Support, Trash Bin, Custom Layouts, CSI u diff --git a/yazi-adapter/src/lib.rs b/yazi-adapter/src/lib.rs index 14304e97..8999cec5 100644 --- a/yazi-adapter/src/lib.rs +++ b/yazi-adapter/src/lib.rs @@ -1,7 +1,7 @@ #![allow(clippy::unit_arg)] yazi_macro::mod_flat!( - adapter, chafa, dimension, emulator, iip, image, kgp, kgp_old, mux, sixel, ueberzug + adapter chafa dimension emulator iip image kgp kgp_old mux sixel ueberzug ); use yazi_shared::{RoCell, env_exists, in_wsl}; diff --git a/yazi-boot/src/actions/mod.rs b/yazi-boot/src/actions/mod.rs index 42b267bc..6a323541 100644 --- a/yazi-boot/src/actions/mod.rs +++ b/yazi-boot/src/actions/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(actions, clear_cache, debug, version); +yazi_macro::mod_flat!(actions clear_cache debug version); diff --git a/yazi-boot/src/lib.rs b/yazi-boot/src/lib.rs index 331394b8..e4c1279d 100644 --- a/yazi-boot/src/lib.rs +++ b/yazi-boot/src/lib.rs @@ -1,6 +1,6 @@ yazi_macro::mod_pub!(actions); -yazi_macro::mod_flat!(args, boot); +yazi_macro::mod_flat!(args boot); use clap::Parser; use yazi_shared::RoCell; diff --git a/yazi-cli/src/package/mod.rs b/yazi-cli/src/package/mod.rs index 1997faa4..15bb2146 100644 --- a/yazi-cli/src/package/mod.rs +++ b/yazi-cli/src/package/mod.rs @@ -1,6 +1,6 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(add, deploy, git, install, package, parser, upgrade); +yazi_macro::mod_flat!(add deploy git install package parser upgrade); use anyhow::Context; diff --git a/yazi-config/preset/keymap.toml b/yazi-config/preset/keymap.toml index 9dabc302..0f59f98b 100644 --- a/yazi-config/preset/keymap.toml +++ b/yazi-config/preset/keymap.toml @@ -46,12 +46,14 @@ keymap = [ { on = "K", run = "seek -5", desc = "Seek up 5 units in the preview" }, { on = "J", run = "seek 5", desc = "Seek down 5 units in the preview" }, - # Selection - { on = "", run = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" }, - { on = "v", run = "visual_mode", desc = "Enter visual mode (selection mode)" }, - { on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, - { on = "", run = "select_all --state=true", desc = "Select all files" }, - { on = "", run = "select_all --state=none", desc = "Inverse selection of all files" }, + # Toggle + { on = "", run = [ "toggle", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = "", run = "toggle_all on", desc = "Select all files" }, + { on = "", run = "toggle_all", desc = "Invert selection of all files" }, + + # Visual mode + { on = "v", run = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, # Operation { on = "o", run = "open", desc = "Open selected files" }, @@ -173,13 +175,13 @@ keymap = [ { on = "", run = "help", desc = "Open help" }, ] -[select] +[pick] keymap = [ - { on = "", run = "close", desc = "Cancel selection" }, - { on = "", run = "close", desc = "Cancel selection" }, - { on = "", run = "close", desc = "Cancel selection" }, - { on = "", run = "close --submit", desc = "Submit the selection" }, + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close --submit", desc = "Submit the pick" }, { on = "k", run = "arrow -1", desc = "Move cursor up" }, { on = "j", run = "arrow 1", desc = "Move cursor down" }, diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index 09e65b03..a5001a2d 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -77,9 +77,9 @@ permissions_s = { fg = "darkgray" } # : }}} -# : Select {{{ +# : Pick {{{ -[select] +[pick] border = { fg = "blue" } active = { fg = "magenta", bold = true } inactive = {} diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index 05a60fa2..9c71da8b 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -191,7 +191,7 @@ quit_content = "The following task is still running, are you sure you want to qu quit_origin = "center" quit_offset = [ 0, 0, 50, 15 ] -[select] +[pick] open_title = "Open with:" open_origin = "hovered" open_offset = [ 0, 1, 50, 7 ] diff --git a/yazi-config/src/keymap/keymap.rs b/yazi-config/src/keymap/keymap.rs index c01851c8..2cf291ad 100644 --- a/yazi-config/src/keymap/keymap.rs +++ b/yazi-config/src/keymap/keymap.rs @@ -11,7 +11,7 @@ use crate::Preset; pub struct Keymap { pub manager: Vec, pub tasks: Vec, - pub select: Vec, + pub pick: Vec, pub input: Vec, pub confirm: Vec, pub help: Vec, @@ -25,7 +25,7 @@ impl Keymap { Layer::App => unreachable!(), Layer::Manager => &self.manager, Layer::Tasks => &self.tasks, - Layer::Select => &self.select, + Layer::Pick => &self.pick, Layer::Input => &self.input, Layer::Confirm => &self.confirm, Layer::Help => &self.help, @@ -50,7 +50,7 @@ impl<'de> Deserialize<'de> for Keymap { struct Shadow { manager: Inner, tasks: Inner, - select: Inner, + pick: Inner, input: Inner, confirm: Inner, help: Inner, @@ -81,7 +81,7 @@ impl<'de> Deserialize<'de> for Keymap { #[rustfmt::skip] tasks: mix(shadow.tasks.keymap, shadow.tasks.prepend_keymap, shadow.tasks.append_keymap), #[rustfmt::skip] - select: mix(shadow.select.keymap, shadow.select.prepend_keymap, shadow.select.append_keymap), + pick: mix(shadow.pick.keymap, shadow.pick.prepend_keymap, shadow.pick.append_keymap), #[rustfmt::skip] input: mix(shadow.input.keymap, shadow.input.prepend_keymap, shadow.input.append_keymap), #[rustfmt::skip] diff --git a/yazi-config/src/keymap/mod.rs b/yazi-config/src/keymap/mod.rs index ce3f75e8..49ebdda2 100644 --- a/yazi-config/src/keymap/mod.rs +++ b/yazi-config/src/keymap/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(chord, cow, deserializers, key, keymap); +yazi_macro::mod_flat!(chord cow deserializers key keymap); diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index da1efe4b..7c09c86d 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -1,8 +1,8 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_pub!(keymap, log, manager, open, plugin, popup, preview, tasks, theme, which); +yazi_macro::mod_pub!(keymap log manager open plugin popup preview tasks theme which); -yazi_macro::mod_flat!(layout, pattern, preset, priority); +yazi_macro::mod_flat!(layout pattern preset priority); use std::str::FromStr; @@ -20,7 +20,7 @@ pub static TASKS: RoCell = RoCell::new(); pub static THEME: RoCell = RoCell::new(); pub static INPUT: RoCell = RoCell::new(); pub static CONFIRM: RoCell = RoCell::new(); -pub static SELECT: RoCell = RoCell::new(); +pub static PICK: RoCell = RoCell::new(); pub static WHICH: RoCell = RoCell::new(); pub fn init() -> anyhow::Result<()> { @@ -41,7 +41,7 @@ pub fn init() -> anyhow::Result<()> { THEME.init(<_>::from_str(theme_toml)?); INPUT.init(<_>::from_str(yazi_toml)?); CONFIRM.init(<_>::from_str(yazi_toml)?); - SELECT.init(<_>::from_str(yazi_toml)?); + PICK.init(<_>::from_str(yazi_toml)?); WHICH.init(<_>::from_str(yazi_toml)?); // TODO: Remove in v0.3.2 diff --git a/yazi-config/src/manager/mod.rs b/yazi-config/src/manager/mod.rs index 0b575ed4..221344eb 100644 --- a/yazi-config/src/manager/mod.rs +++ b/yazi-config/src/manager/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(manager, mouse, ratio, sorting); +yazi_macro::mod_flat!(manager mouse ratio sorting); diff --git a/yazi-config/src/open/mod.rs b/yazi-config/src/open/mod.rs index 77e69988..4ae31041 100644 --- a/yazi-config/src/open/mod.rs +++ b/yazi-config/src/open/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(open, opener, rule); +yazi_macro::mod_flat!(open opener rule); diff --git a/yazi-config/src/plugin/mod.rs b/yazi-config/src/plugin/mod.rs index 7df6c87a..97efd0eb 100644 --- a/yazi-config/src/plugin/mod.rs +++ b/yazi-config/src/plugin/mod.rs @@ -1,3 +1,3 @@ -yazi_macro::mod_flat!(fetcher, plugin, preloader, previewer); +yazi_macro::mod_flat!(fetcher plugin preloader previewer); pub const MAX_PREWORKERS: u8 = 32; diff --git a/yazi-config/src/popup/mod.rs b/yazi-config/src/popup/mod.rs index 8adc3f49..520d083a 100644 --- a/yazi-config/src/popup/mod.rs +++ b/yazi-config/src/popup/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(confirm, input, offset, options, origin, position, select); +yazi_macro::mod_flat!(confirm input offset options origin pick position); diff --git a/yazi-config/src/popup/options.rs b/yazi-config/src/popup/options.rs index 6cf419d9..c97a640c 100644 --- a/yazi-config/src/popup/options.rs +++ b/yazi-config/src/popup/options.rs @@ -2,7 +2,7 @@ use ratatui::{text::Text, widgets::{Paragraph, Wrap}}; use yazi_shared::fs::Url; use super::{Offset, Origin, Position}; -use crate::{CONFIRM, INPUT, SELECT}; +use crate::{CONFIRM, INPUT, PICK}; #[derive(Default)] pub struct InputCfg { @@ -16,7 +16,7 @@ pub struct InputCfg { } #[derive(Default)] -pub struct SelectCfg { +pub struct PickCfg { pub title: String, pub items: Vec, pub position: Position, @@ -176,21 +176,18 @@ impl ConfirmCfg { } } -impl SelectCfg { +impl PickCfg { #[inline] fn max_height(len: usize) -> u16 { - SELECT.open_offset.height.min(SELECT.border().saturating_add(len as u16)) + PICK.open_offset.height.min(PICK.border().saturating_add(len as u16)) } pub fn open(items: Vec) -> Self { let max_height = Self::max_height(items.len()); Self { - title: SELECT.open_title.to_owned(), + title: PICK.open_title.to_owned(), items, - position: Position::new(SELECT.open_origin, Offset { - height: max_height, - ..SELECT.open_offset - }), + position: Position::new(PICK.open_origin, Offset { height: max_height, ..PICK.open_offset }), } } } diff --git a/yazi-config/src/popup/select.rs b/yazi-config/src/popup/pick.rs similarity index 75% rename from yazi-config/src/popup/select.rs rename to yazi-config/src/popup/pick.rs index df584df8..ea2218c3 100644 --- a/yazi-config/src/popup/select.rs +++ b/yazi-config/src/popup/pick.rs @@ -5,26 +5,26 @@ use serde::Deserialize; use super::{Offset, Origin}; #[derive(Deserialize)] -pub struct Select { +pub struct Pick { // open pub open_title: String, pub open_origin: Origin, pub open_offset: Offset, } -impl Select { +impl Pick { pub const fn border(&self) -> u16 { 2 } } -impl FromStr for Select { +impl FromStr for Pick { type Err = toml::de::Error; fn from_str(s: &str) -> Result { #[derive(Deserialize)] struct Outer { - select: Select, + pick: Pick, } - Ok(toml::from_str::(s)?.select) + Ok(toml::from_str::(s)?.pick) } } diff --git a/yazi-config/src/preview/mod.rs b/yazi-config/src/preview/mod.rs index de986496..71bc68ab 100644 --- a/yazi-config/src/preview/mod.rs +++ b/yazi-config/src/preview/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(preview, wrap); +yazi_macro::mod_flat!(preview wrap); diff --git a/yazi-config/src/theme/mod.rs b/yazi-config/src/theme/mod.rs index c83e4f80..4de4fb71 100644 --- a/yazi-config/src/theme/mod.rs +++ b/yazi-config/src/theme/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(filetype, flavor, icons, is, theme); +yazi_macro::mod_flat!(filetype flavor icons is theme); diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index a8d6e417..6f872bf1 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -12,7 +12,7 @@ pub struct Theme { pub manager: Manager, status: Status, pub input: Input, - pub select: Select, + pub pick: Pick, pub completion: Completion, pub tasks: Tasks, pub which: Which, @@ -115,7 +115,7 @@ pub struct Input { } #[derive(Deserialize, Serialize)] -pub struct Select { +pub struct Pick { pub border: Style, pub active: Style, pub inactive: Style, diff --git a/yazi-config/src/which/mod.rs b/yazi-config/src/which/mod.rs index f1bdfe23..67ce5a71 100644 --- a/yazi-config/src/which/mod.rs +++ b/yazi-config/src/which/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(sorting, which); +yazi_macro::mod_flat!(sorting which); diff --git a/yazi-core/src/completion/commands/mod.rs b/yazi-core/src/completion/commands/mod.rs index 725cdd0c..e1a77788 100644 --- a/yazi-core/src/completion/commands/mod.rs +++ b/yazi-core/src/completion/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(arrow, close, show, trigger); +yazi_macro::mod_flat!(arrow close show trigger); diff --git a/yazi-core/src/confirm/commands/mod.rs b/yazi-core/src/confirm/commands/mod.rs index 9fcab941..e0fc92ad 100644 --- a/yazi-core/src/confirm/commands/mod.rs +++ b/yazi-core/src/confirm/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(arrow, close, show); +yazi_macro::mod_flat!(arrow close show); diff --git a/yazi-core/src/help/commands/mod.rs b/yazi-core/src/help/commands/mod.rs index cfc4c62e..11f3a072 100644 --- a/yazi-core/src/help/commands/mod.rs +++ b/yazi-core/src/help/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(arrow, escape, filter); +yazi_macro::mod_flat!(arrow escape filter); diff --git a/yazi-core/src/input/commands/mod.rs b/yazi-core/src/input/commands/mod.rs index bd03c07e..6648217c 100644 --- a/yazi-core/src/input/commands/mod.rs +++ b/yazi-core/src/input/commands/mod.rs @@ -1,4 +1,4 @@ yazi_macro::mod_flat!( - backspace, backward, close, complete, delete, escape, forward, insert, kill, move_, paste, redo, - show, type_, undo, visual, yank + backspace backward close complete delete escape forward insert kill move_ paste redo + show type_ undo visual yank ); diff --git a/yazi-core/src/input/mod.rs b/yazi-core/src/input/mod.rs index a6ce5b78..bc6b58ab 100644 --- a/yazi-core/src/input/mod.rs +++ b/yazi-core/src/input/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(input, mode, op, snap, snaps); +yazi_macro::mod_flat!(input mode op snap snaps); diff --git a/yazi-core/src/input/op.rs b/yazi-core/src/input/op.rs index 7a2fbae2..55ab0772 100644 --- a/yazi-core/src/input/op.rs +++ b/yazi-core/src/input/op.rs @@ -5,8 +5,7 @@ pub enum InputOp { #[default] None, Select(usize), - // cut, insert, start - Delete(bool, bool, usize), + Delete(bool, bool, usize), // cut, insert, start Yank(usize), } diff --git a/yazi-core/src/lib.rs b/yazi-core/src/lib.rs index 952774c5..8d7616ef 100644 --- a/yazi-core/src/lib.rs +++ b/yazi-core/src/lib.rs @@ -6,7 +6,7 @@ clippy::unit_arg )] -yazi_macro::mod_pub!(completion, confirm, help, input, manager, notify, select, tab, tasks, which); +yazi_macro::mod_pub!(completion confirm help input manager notify pick tab tasks which); pub fn init() { manager::WATCHED.with(<_>::default); diff --git a/yazi-core/src/manager/commands/mod.rs b/yazi-core/src/manager/commands/mod.rs index f6d02117..aba8b14b 100644 --- a/yazi-core/src/manager/commands/mod.rs +++ b/yazi-core/src/manager/commands/mod.rs @@ -1,28 +1,28 @@ yazi_macro::mod_flat!( - bulk_rename, - close, - create, - hardlink, - hover, - link, - open, - paste, - peek, - quit, - refresh, - remove, - rename, - seek, - suspend, - tab_close, - tab_create, - tab_swap, - tab_switch, - unyank, - update_files, - update_mimetype, - update_paged, - update_task, - update_yanked, + bulk_rename + close + create + hardlink + hover + link + open + paste + peek + quit + refresh + remove + rename + seek + suspend + tab_close + tab_create + tab_swap + tab_switch + unyank + update_files + update_mimetype + update_paged + update_task + update_yanked yank ); diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index 449a15d8..630455b5 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, ffi::OsString}; use tracing::error; use yazi_boot::ARGS; -use yazi_config::{OPEN, popup::SelectCfg}; +use yazi_config::{OPEN, popup::PickCfg}; use yazi_fs::Folder; use yazi_macro::emit; use yazi_plugin::isolate; @@ -96,7 +96,7 @@ impl Manager { let urls = [opt.hovered].into_iter().chain(targets.into_iter().map(|(u, _)| u)).collect(); tokio::spawn(async move { - let result = yazi_proxy::SelectProxy::show(SelectCfg::open( + let result = yazi_proxy::PickProxy::show(PickCfg::open( openers.iter().map(|o| o.desc.clone()).collect(), )); if let Ok(choice) = result.await { diff --git a/yazi-core/src/manager/mod.rs b/yazi-core/src/manager/mod.rs index 8cf5fa8d..249f4dbb 100644 --- a/yazi-core/src/manager/mod.rs +++ b/yazi-core/src/manager/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(linked, manager, mimetype, tabs, watcher, yanked); +yazi_macro::mod_flat!(linked manager mimetype tabs watcher yanked); diff --git a/yazi-core/src/notify/commands/mod.rs b/yazi-core/src/notify/commands/mod.rs index b8432b51..b7ec7334 100644 --- a/yazi-core/src/notify/commands/mod.rs +++ b/yazi-core/src/notify/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(push, tick); +yazi_macro::mod_flat!(push tick); diff --git a/yazi-core/src/notify/mod.rs b/yazi-core/src/notify/mod.rs index 9a51e43e..d98ded95 100644 --- a/yazi-core/src/notify/mod.rs +++ b/yazi-core/src/notify/mod.rs @@ -1,6 +1,6 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(message, notify); +yazi_macro::mod_flat!(message notify); pub const NOTIFY_BORDER: u16 = 2; pub const NOTIFY_SPACING: u16 = 1; diff --git a/yazi-core/src/select/commands/arrow.rs b/yazi-core/src/pick/commands/arrow.rs similarity index 96% rename from yazi-core/src/select/commands/arrow.rs rename to yazi-core/src/pick/commands/arrow.rs index deea6b36..e78883e8 100644 --- a/yazi-core/src/select/commands/arrow.rs +++ b/yazi-core/src/pick/commands/arrow.rs @@ -1,7 +1,7 @@ use yazi_macro::render; use yazi_shared::event::{Cmd, Data}; -use crate::select::Select; +use crate::pick::Pick; struct Opt { step: isize, @@ -11,7 +11,7 @@ impl From for Opt { fn from(c: Cmd) -> Self { Self { step: c.first().and_then(Data::as_isize).unwrap_or(0) } } } -impl Select { +impl Pick { #[yazi_codegen::command] pub fn arrow(&mut self, opt: Opt) { if opt.step > 0 { self.next(opt.step as usize) } else { self.prev(opt.step.unsigned_abs()) } diff --git a/yazi-core/src/select/commands/close.rs b/yazi-core/src/pick/commands/close.rs similarity index 93% rename from yazi-core/src/select/commands/close.rs rename to yazi-core/src/pick/commands/close.rs index 6e73fd8b..cd684345 100644 --- a/yazi-core/src/select/commands/close.rs +++ b/yazi-core/src/pick/commands/close.rs @@ -2,7 +2,7 @@ use anyhow::anyhow; use yazi_macro::render; use yazi_shared::event::Cmd; -use crate::select::Select; +use crate::pick::Pick; struct Opt { submit: bool, @@ -15,7 +15,7 @@ impl From for Opt { fn from(submit: bool) -> Self { Self { submit } } } -impl Select { +impl Pick { #[yazi_codegen::command] pub fn close(&mut self, opt: Opt) { if let Some(cb) = self.callback.take() { diff --git a/yazi-core/src/pick/commands/mod.rs b/yazi-core/src/pick/commands/mod.rs new file mode 100644 index 00000000..e0fc92ad --- /dev/null +++ b/yazi-core/src/pick/commands/mod.rs @@ -0,0 +1 @@ +yazi_macro::mod_flat!(arrow close show); diff --git a/yazi-core/src/select/commands/show.rs b/yazi-core/src/pick/commands/show.rs similarity index 87% rename from yazi-core/src/select/commands/show.rs rename to yazi-core/src/pick/commands/show.rs index 022fb8b3..dc24fefe 100644 --- a/yazi-core/src/select/commands/show.rs +++ b/yazi-core/src/pick/commands/show.rs @@ -1,12 +1,12 @@ use tokio::sync::oneshot; -use yazi_config::popup::SelectCfg; +use yazi_config::popup::PickCfg; use yazi_macro::render; use yazi_shared::event::Cmd; -use crate::select::Select; +use crate::pick::Pick; pub struct Opt { - cfg: SelectCfg, + cfg: PickCfg, tx: oneshot::Sender>, } @@ -18,7 +18,7 @@ impl TryFrom for Opt { } } -impl Select { +impl Pick { pub fn show(&mut self, opt: impl TryInto) { let Ok(opt) = opt.try_into() else { return; diff --git a/yazi-core/src/select/mod.rs b/yazi-core/src/pick/mod.rs similarity index 51% rename from yazi-core/src/select/mod.rs rename to yazi-core/src/pick/mod.rs index 02c53b3c..c9f4add5 100644 --- a/yazi-core/src/select/mod.rs +++ b/yazi-core/src/pick/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(select); +yazi_macro::mod_flat!(pick); diff --git a/yazi-core/src/select/select.rs b/yazi-core/src/pick/pick.rs similarity index 79% rename from yazi-core/src/select/select.rs rename to yazi-core/src/pick/pick.rs index c86f27a4..dba61eb6 100644 --- a/yazi-core/src/select/select.rs +++ b/yazi-core/src/pick/pick.rs @@ -1,9 +1,9 @@ use anyhow::Result; use tokio::sync::oneshot::Sender; -use yazi_config::{SELECT, popup::Position}; +use yazi_config::{PICK, popup::Position}; #[derive(Default)] -pub struct Select { +pub struct Pick { pub(super) title: String, pub(super) items: Vec, pub position: Position, @@ -15,7 +15,7 @@ pub struct Select { pub visible: bool, } -impl Select { +impl Pick { #[inline] pub fn window(&self) -> &[String] { let end = (self.offset + self.limit()).min(self.items.len()); @@ -24,11 +24,11 @@ impl Select { #[inline] pub(super) fn limit(&self) -> usize { - self.position.offset.height.saturating_sub(SELECT.border()) as usize + self.position.offset.height.saturating_sub(PICK.border()) as usize } } -impl Select { +impl Pick { #[inline] pub fn title(&self) -> String { self.title.clone() } diff --git a/yazi-core/src/select/commands/mod.rs b/yazi-core/src/select/commands/mod.rs deleted file mode 100644 index 9fcab941..00000000 --- a/yazi-core/src/select/commands/mod.rs +++ /dev/null @@ -1 +0,0 @@ -yazi_macro::mod_flat!(arrow, close, show); diff --git a/yazi-core/src/tab/commands/mod.rs b/yazi-core/src/tab/commands/mod.rs index dddf38dc..6ef89e27 100644 --- a/yazi-core/src/tab/commands/mod.rs +++ b/yazi-core/src/tab/commands/mod.rs @@ -1,25 +1,27 @@ yazi_macro::mod_flat!( - arrow, - back, - cd, - copy, - enter, - escape, - filter, - filter_do, - find, - find_arrow, - find_do, - forward, - hidden, - leave, - linemode, - preview, - reveal, - search, - select, - select_all, - shell, - sort, + arrow + back + cd + copy + enter + escape + filter + filter_do + find + find_arrow + find_do + forward + hidden + leave + linemode + preview + reveal + search + select + select_all + shell + sort + toggle + toggle_all visual_mode ); diff --git a/yazi-core/src/tab/commands/select.rs b/yazi-core/src/tab/commands/select.rs index 94fc57c2..99720550 100644 --- a/yazi-core/src/tab/commands/select.rs +++ b/yazi-core/src/tab/commands/select.rs @@ -1,48 +1,30 @@ -use std::borrow::Cow; +use std::time::Duration; -use yazi_macro::render_and; -use yazi_proxy::AppProxy; -use yazi_shared::{event::{Cmd, Data}, fs::Url}; +use yazi_shared::event::Cmd; use crate::tab::Tab; -struct Opt<'a> { - url: Option>, - state: Option, +struct Opt; + +impl From for Opt { + fn from(_: Cmd) -> Self { Self } } -impl<'a> From for Opt<'a> { - fn from(mut c: Cmd) -> Self { - Self { - url: c.take("url").and_then(Data::into_url).map(Cow::Owned), - state: match c.take_str("state").as_deref() { - Some("true") => Some(true), - Some("false") => Some(false), - _ => None, - }, - } - } +impl From<()> for Opt { + fn from(_: ()) -> Self { Self } } -impl<'a> Tab { +impl Tab { + // TODO: remove this in Yazi 0.4.1 #[yazi_codegen::command] - pub fn select(&mut self, opt: Opt<'a>) { - let Some(url) = opt.url.or_else(|| self.current.hovered().map(|h| Cow::Borrowed(&h.url))) - else { - return; - }; + pub fn select(&mut self, _: Opt) { + yazi_proxy::AppProxy::notify(yazi_proxy::options::NotifyOpt { + title: "Deprecated command".to_owned(), + content: "`select` and `select_all` command has been renamed to `toggle` and `toggle_all` in Yazi v0.4 - let b = match opt.state { - Some(true) => render_and!(self.selected.add(&url)), - Some(false) => render_and!(self.selected.remove(&url)) | true, - None => render_and!(self.selected.remove(&url) || self.selected.add(&url)), - }; - - if !b { - AppProxy::notify_warn( - "Select one", - "This file cannot be selected, due to path nesting conflict.", - ); - } +Please change it in your keymap.toml, see #1773 for details: https://github.com/sxyazi/yazi/pull/1773".to_owned(), + level: yazi_proxy::options::NotifyLevel::Error, + timeout: Duration::from_secs(20), + }); } } diff --git a/yazi-core/src/tab/commands/select_all.rs b/yazi-core/src/tab/commands/select_all.rs index 4e568494..55ce6cb7 100644 --- a/yazi-core/src/tab/commands/select_all.rs +++ b/yazi-core/src/tab/commands/select_all.rs @@ -1,49 +1,15 @@ -use yazi_macro::render; -use yazi_proxy::AppProxy; use yazi_shared::event::Cmd; use crate::tab::Tab; -struct Opt { - state: Option, -} +struct Opt; impl From for Opt { - fn from(mut c: Cmd) -> Self { - Self { - state: match c.take_str("state").as_deref() { - Some("true") => Some(true), - Some("false") => Some(false), - _ => None, - }, - } - } -} -impl From> for Opt { - fn from(state: Option) -> Self { Self { state } } + fn from(_: Cmd) -> Self { Self } } impl Tab { + // TODO: remove this in Yazi 0.4.1 #[yazi_codegen::command] - pub fn select_all(&mut self, opt: Opt) { - let iter = self.current.files.iter().map(|f| &f.url); - let (removal, addition): (Vec<_>, Vec<_>) = match opt.state { - Some(true) => (vec![], iter.collect()), - Some(false) => (iter.collect(), vec![]), - None => iter.partition(|&u| self.selected.contains_key(u)), - }; - - let same = !self.cwd().is_search(); - render!(self.selected.remove_many(&removal, same) > 0); - - let added = self.selected.add_many(&addition, same); - render!(added > 0); - - if added != addition.len() { - AppProxy::notify_warn( - "Select all", - "Some files cannot be selected, due to path nesting conflict.", - ); - } - } + pub fn select_all(&mut self, _: Opt) { self.select(()); } } diff --git a/yazi-core/src/tab/commands/toggle.rs b/yazi-core/src/tab/commands/toggle.rs new file mode 100644 index 00000000..99764a36 --- /dev/null +++ b/yazi-core/src/tab/commands/toggle.rs @@ -0,0 +1,43 @@ +use yazi_macro::render_and; +use yazi_proxy::AppProxy; +use yazi_shared::event::Cmd; + +use crate::tab::Tab; + +struct Opt { + state: Option, +} + +impl From for Opt { + fn from(mut c: Cmd) -> Self { + Self { + state: match c.take_first_str().as_deref() { + Some("on") => Some(true), + Some("off") => Some(false), + _ => None, + }, + } + } +} + +impl Tab { + #[yazi_codegen::command] + pub fn toggle(&mut self, opt: Opt) { + let Some(url) = self.current.hovered().map(|h| &h.url) else { + return; + }; + + let b = match opt.state { + Some(true) => render_and!(self.selected.add(url)), + Some(false) => render_and!(self.selected.remove(url)) | true, + None => render_and!(self.selected.remove(url) || self.selected.add(url)), + }; + + if !b { + AppProxy::notify_warn( + "Toggle", + "This file cannot be selected, due to path nesting conflict.", + ); + } + } +} diff --git a/yazi-core/src/tab/commands/toggle_all.rs b/yazi-core/src/tab/commands/toggle_all.rs new file mode 100644 index 00000000..ebab9e97 --- /dev/null +++ b/yazi-core/src/tab/commands/toggle_all.rs @@ -0,0 +1,49 @@ +use yazi_macro::render; +use yazi_proxy::AppProxy; +use yazi_shared::event::Cmd; + +use crate::tab::Tab; + +struct Opt { + state: Option, +} + +impl From for Opt { + fn from(mut c: Cmd) -> Self { + Self { + state: match c.take_first_str().as_deref() { + Some("on") => Some(true), + Some("off") => Some(false), + _ => None, + }, + } + } +} +impl From> for Opt { + fn from(state: Option) -> Self { Self { state } } +} + +impl Tab { + #[yazi_codegen::command] + pub fn toggle_all(&mut self, opt: Opt) { + let iter = self.current.files.iter().map(|f| &f.url); + let (removal, addition): (Vec<_>, Vec<_>) = match opt.state { + Some(true) => (vec![], iter.collect()), + Some(false) => (iter.collect(), vec![]), + None => iter.partition(|&u| self.selected.contains_key(u)), + }; + + let same = !self.cwd().is_search(); + render!(self.selected.remove_many(&removal, same) > 0); + + let added = self.selected.add_many(&addition, same); + render!(added > 0); + + if added != addition.len() { + AppProxy::notify_warn( + "Toggle all", + "Some files cannot be selected, due to path nesting conflict.", + ); + } + } +} diff --git a/yazi-core/src/tab/mod.rs b/yazi-core/src/tab/mod.rs index 763352ad..9c34efe4 100644 --- a/yazi-core/src/tab/mod.rs +++ b/yazi-core/src/tab/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(backstack, config, finder, history, mode, preview, selected, tab); +yazi_macro::mod_flat!(backstack config finder history mode preview selected tab); diff --git a/yazi-core/src/tasks/commands/mod.rs b/yazi-core/src/tasks/commands/mod.rs index f1df829e..1c6b43d9 100644 --- a/yazi-core/src/tasks/commands/mod.rs +++ b/yazi-core/src/tasks/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(arrow, cancel, inspect, open_with, process_exec, toggle); +yazi_macro::mod_flat!(arrow cancel inspect open_with process_exec toggle); diff --git a/yazi-core/src/tasks/mod.rs b/yazi-core/src/tasks/mod.rs index 81d84f56..77dff620 100644 --- a/yazi-core/src/tasks/mod.rs +++ b/yazi-core/src/tasks/mod.rs @@ -1,6 +1,6 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(file, plugin, preload, process, progress, tasks); +yazi_macro::mod_flat!(file plugin preload process progress tasks); pub const TASKS_BORDER: u16 = 2; pub const TASKS_PADDING: u16 = 2; diff --git a/yazi-core/src/which/commands/mod.rs b/yazi-core/src/which/commands/mod.rs index 8e7d873c..ab7eaca0 100644 --- a/yazi-core/src/which/commands/mod.rs +++ b/yazi-core/src/which/commands/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(callback, show); +yazi_macro::mod_flat!(callback show); diff --git a/yazi-core/src/which/mod.rs b/yazi-core/src/which/mod.rs index 038e3f24..2ce4088c 100644 --- a/yazi-core/src/which/mod.rs +++ b/yazi-core/src/which/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(commands); -yazi_macro::mod_flat!(sorter, which); +yazi_macro::mod_flat!(sorter which); diff --git a/yazi-dds/src/body/mod.rs b/yazi-dds/src/body/mod.rs index 2d2846dc..a10d53ff 100644 --- a/yazi-dds/src/body/mod.rs +++ b/yazi-dds/src/body/mod.rs @@ -1,5 +1,5 @@ #![allow(clippy::module_inception)] yazi_macro::mod_flat!( - body, bulk, bye, cd, custom, delete, hey, hi, hover, move_, rename, tab, trash, yank + body bulk bye cd custom delete hey hi hover move_ rename tab trash yank ); diff --git a/yazi-dds/src/lib.rs b/yazi-dds/src/lib.rs index f206e762..3f7acb1a 100644 --- a/yazi-dds/src/lib.rs +++ b/yazi-dds/src/lib.rs @@ -2,7 +2,7 @@ yazi_macro::mod_pub!(body); -yazi_macro::mod_flat!(client, payload, pubsub, pump, sendable, server, state, stream); +yazi_macro::mod_flat!(client payload pubsub pump sendable server state stream); pub fn init() { let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); diff --git a/yazi-fm/src/app/commands/mod.rs b/yazi-fm/src/app/commands/mod.rs index 8e118986..8c920955 100644 --- a/yazi-fm/src/app/commands/mod.rs +++ b/yazi-fm/src/app/commands/mod.rs @@ -1,13 +1,13 @@ yazi_macro::mod_flat!( - accept_payload, - mouse, - notify, - plugin, - quit, - render, - resize, - resume, - stop, - update_notify, + accept_payload + mouse + notify + plugin + quit + render + resize + resume + stop + update_notify update_progress ); diff --git a/yazi-fm/src/components/mod.rs b/yazi-fm/src/components/mod.rs index 45c467f8..2b7b0da6 100644 --- a/yazi-fm/src/components/mod.rs +++ b/yazi-fm/src/components/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(preview, progress); +yazi_macro::mod_flat!(preview progress); diff --git a/yazi-fm/src/confirm/mod.rs b/yazi-fm/src/confirm/mod.rs index 34ffe6ab..b743a906 100644 --- a/yazi-fm/src/confirm/mod.rs +++ b/yazi-fm/src/confirm/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(buttons, confirm, content, list); +yazi_macro::mod_flat!(buttons confirm content list); diff --git a/yazi-fm/src/context.rs b/yazi-fm/src/context.rs index c97336e2..3d46b539 100644 --- a/yazi-fm/src/context.rs +++ b/yazi-fm/src/context.rs @@ -1,10 +1,10 @@ use ratatui::layout::Rect; -use yazi_core::{completion::Completion, confirm::Confirm, help::Help, input::Input, manager::Manager, notify::Notify, select::Select, tasks::Tasks, which::Which}; +use yazi_core::{completion::Completion, confirm::Confirm, help::Help, input::Input, manager::Manager, notify::Notify, pick::Pick, tasks::Tasks, which::Which}; pub struct Ctx { pub manager: Manager, pub tasks: Tasks, - pub select: Select, + pub pick: Pick, pub input: Input, pub confirm: Confirm, pub help: Help, @@ -18,7 +18,7 @@ impl Ctx { Self { manager: Manager::make(), tasks: Tasks::serve(), - select: Default::default(), + pick: Default::default(), input: Default::default(), confirm: Default::default(), help: Default::default(), diff --git a/yazi-fm/src/executor.rs b/yazi-fm/src/executor.rs index 6b6addf7..278f5e23 100644 --- a/yazi-fm/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -17,7 +17,7 @@ impl<'a> Executor<'a> { Layer::App => self.app(cmd), Layer::Manager => self.manager(cmd), Layer::Tasks => self.tasks(cmd), - Layer::Select => self.select(cmd), + Layer::Pick => self.pick(cmd), Layer::Input => self.input(cmd), Layer::Confirm => self.confirm(cmd), Layer::Help => self.help(cmd), @@ -89,10 +89,12 @@ impl<'a> Executor<'a> { on!(ACTIVE, cd); on!(ACTIVE, reveal); - // Selection + // Toggle + on!(ACTIVE, toggle); + on!(ACTIVE, toggle_all); + on!(ACTIVE, visual_mode); on!(ACTIVE, select); on!(ACTIVE, select_all); - on!(ACTIVE, visual_mode); // Operation on!(MANAGER, open, &self.app.cx.tasks); @@ -172,11 +174,11 @@ impl<'a> Executor<'a> { } } - fn select(&mut self, cmd: Cmd) { + fn pick(&mut self, cmd: Cmd) { macro_rules! on { ($name:ident) => { if cmd.name == stringify!($name) { - return self.app.cx.select.$name(cmd); + return self.app.cx.pick.$name(cmd); } }; } @@ -187,7 +189,7 @@ impl<'a> Executor<'a> { match cmd.name.as_str() { // Help - "help" => self.app.cx.help.toggle(Layer::Select), + "help" => self.app.cx.help.toggle(Layer::Pick), // Plugin "plugin" => self.app.plugin(cmd), _ => {} diff --git a/yazi-fm/src/help/mod.rs b/yazi-fm/src/help/mod.rs index bf28974f..53f65c8a 100644 --- a/yazi-fm/src/help/mod.rs +++ b/yazi-fm/src/help/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(bindings, layout); +yazi_macro::mod_flat!(bindings layout); diff --git a/yazi-fm/src/lives/mod.rs b/yazi-fm/src/lives/mod.rs index a55b4c3f..953601bc 100644 --- a/yazi-fm/src/lives/mod.rs +++ b/yazi-fm/src/lives/mod.rs @@ -1,8 +1,8 @@ #![allow(clippy::module_inception)] yazi_macro::mod_flat!( - config, file, files, filter, finder, folder, iter, lives, mode, preview, selected, tab, tabs, - tasks, yanked + config file files filter finder folder iter lives mode preview selected tab tabs + tasks yanked ); type CtxRef<'lua> = mlua::UserDataRef<'lua, crate::Ctx>; diff --git a/yazi-fm/src/main.rs b/yazi-fm/src/main.rs index d2a8b4ef..ac33b1c9 100644 --- a/yazi-fm/src/main.rs +++ b/yazi-fm/src/main.rs @@ -6,10 +6,10 @@ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; yazi_macro::mod_pub!( - app, completion, components, confirm, help, input, lives, notify, select, tasks, which + app completion components confirm help input lives notify pick tasks which ); -yazi_macro::mod_flat!(context, executor, logs, panic, root, router, signals, term); +yazi_macro::mod_flat!(context executor logs panic root router signals term); #[tokio::main] async fn main() -> anyhow::Result<()> { diff --git a/yazi-fm/src/pick/mod.rs b/yazi-fm/src/pick/mod.rs new file mode 100644 index 00000000..7275cd93 --- /dev/null +++ b/yazi-fm/src/pick/mod.rs @@ -0,0 +1 @@ +yazi_macro::mod_flat!(pick); diff --git a/yazi-fm/src/select/select.rs b/yazi-fm/src/pick/pick.rs similarity index 54% rename from yazi-fm/src/select/select.rs rename to yazi-fm/src/pick/pick.rs index 2fc04a45..4cbace5f 100644 --- a/yazi-fm/src/select/select.rs +++ b/yazi-fm/src/pick/pick.rs @@ -3,29 +3,29 @@ use yazi_config::THEME; use crate::Ctx; -pub(crate) struct Select<'a> { +pub(crate) struct Pick<'a> { cx: &'a Ctx, } -impl<'a> Select<'a> { +impl<'a> Pick<'a> { pub(crate) fn new(cx: &'a Ctx) -> Self { Self { cx } } } -impl<'a> Widget for Select<'a> { +impl<'a> Widget for Pick<'a> { fn render(self, _: Rect, buf: &mut Buffer) { - let select = &self.cx.select; - let area = self.cx.manager.area(select.position); + let pick = &self.cx.pick; + let area = self.cx.manager.area(pick.position); - let items: Vec<_> = select + let items: Vec<_> = pick .window() .iter() .enumerate() .map(|(i, v)| { - if i != select.rel_cursor() { - return ListItem::new(format!(" {v}")).style(THEME.select.inactive); + if i != pick.rel_cursor() { + return ListItem::new(format!(" {v}")).style(THEME.pick.inactive); } - ListItem::new(format!(" {v}")).style(THEME.select.active) + ListItem::new(format!(" {v}")).style(THEME.pick.active) }) .collect(); @@ -33,9 +33,9 @@ impl<'a> Widget for Select<'a> { List::new(items) .block( Block::bordered() - .title(select.title()) + .title(pick.title()) .border_type(BorderType::Rounded) - .border_style(THEME.select.border), + .border_style(THEME.pick.border), ) .render(area, buf); } diff --git a/yazi-fm/src/root.rs b/yazi-fm/src/root.rs index a10f5742..60d60746 100644 --- a/yazi-fm/src/root.rs +++ b/yazi-fm/src/root.rs @@ -3,7 +3,7 @@ use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget}; use tracing::error; use yazi_plugin::{LUA, elements::render_widgets}; -use super::{completion, confirm, input, select, tasks, which}; +use super::{completion, confirm, input, pick, tasks, which}; use crate::{Ctx, components, help}; pub(super) struct Root<'a> { @@ -33,8 +33,8 @@ impl<'a> Widget for Root<'a> { tasks::Layout::new(self.cx).render(area, buf); } - if self.cx.select.visible { - select::Select::new(self.cx).render(area, buf); + if self.cx.pick.visible { + pick::Pick::new(self.cx).render(area, buf); } if self.cx.input.visible { diff --git a/yazi-fm/src/router.rs b/yazi-fm/src/router.rs index dc56e9c5..1f45da53 100644 --- a/yazi-fm/src/router.rs +++ b/yazi-fm/src/router.rs @@ -34,8 +34,8 @@ impl<'a> Router<'a> { self.matches(Layer::Input, key) } else if cx.confirm.visible { self.matches(Layer::Confirm, key) - } else if cx.select.visible { - self.matches(Layer::Select, key) + } else if cx.pick.visible { + self.matches(Layer::Pick, key) } else if cx.tasks.visible { self.matches(Layer::Tasks, key) } else { diff --git a/yazi-fm/src/select/mod.rs b/yazi-fm/src/select/mod.rs deleted file mode 100644 index fae8b47f..00000000 --- a/yazi-fm/src/select/mod.rs +++ /dev/null @@ -1 +0,0 @@ -yazi_macro::mod_flat!(select); diff --git a/yazi-fm/src/which/mod.rs b/yazi-fm/src/which/mod.rs index 43d97037..2d0635bd 100644 --- a/yazi-fm/src/which/mod.rs +++ b/yazi-fm/src/which/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(cand, layout); +yazi_macro::mod_flat!(cand layout); diff --git a/yazi-fs/src/lib.rs b/yazi-fs/src/lib.rs index 7e206169..16f1b1e0 100644 --- a/yazi-fs/src/lib.rs +++ b/yazi-fs/src/lib.rs @@ -1,3 +1,3 @@ #![allow(clippy::if_same_then_else)] -yazi_macro::mod_flat!(files, filter, folder, sorter, stage, step); +yazi_macro::mod_flat!(files filter folder sorter stage step); diff --git a/yazi-plugin/src/bindings/mod.rs b/yazi-plugin/src/bindings/mod.rs index 58009cb5..703da022 100644 --- a/yazi-plugin/src/bindings/mod.rs +++ b/yazi-plugin/src/bindings/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(bindings, icon, input, mouse, permit, position, range, window); +yazi_macro::mod_flat!(bindings icon input mouse permit position range window); diff --git a/yazi-plugin/src/elements/mod.rs b/yazi-plugin/src/elements/mod.rs index 31b0fb75..b9c3d144 100644 --- a/yazi-plugin/src/elements/mod.rs +++ b/yazi-plugin/src/elements/mod.rs @@ -1,6 +1,6 @@ #![allow(clippy::module_inception)] yazi_macro::mod_flat!( - bar, border, clear, constraint, elements, gauge, layout, line, list, padding, paragraph, - position, rect, span, style + bar border clear constraint elements gauge layout line list padding paragraph + position rect span style ); diff --git a/yazi-plugin/src/external/mod.rs b/yazi-plugin/src/external/mod.rs index 401e6475..ded3f3b2 100644 --- a/yazi-plugin/src/external/mod.rs +++ b/yazi-plugin/src/external/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(fd, highlighter, rg); +yazi_macro::mod_flat!(fd highlighter rg); diff --git a/yazi-plugin/src/isolate/mod.rs b/yazi-plugin/src/isolate/mod.rs index a9ce95c2..b8b126b6 100644 --- a/yazi-plugin/src/isolate/mod.rs +++ b/yazi-plugin/src/isolate/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(entry, fetch, isolate, peek, preload, seek); +yazi_macro::mod_flat!(entry fetch isolate peek preload seek); diff --git a/yazi-plugin/src/lib.rs b/yazi-plugin/src/lib.rs index d878fc59..fce69595 100644 --- a/yazi-plugin/src/lib.rs +++ b/yazi-plugin/src/lib.rs @@ -6,7 +6,7 @@ yazi_macro::mod_pub!( bindings, cha, elements, external, file, fs, isolate, loader, process, pubsub, url, utils ); -yazi_macro::mod_flat!(cast, clipboard, config, lua, opt, runtime); +yazi_macro::mod_flat!(cast clipboard config lua opt runtime); pub fn init() -> anyhow::Result<()> { CLIPBOARD.with(<_>::default); diff --git a/yazi-plugin/src/loader/mod.rs b/yazi-plugin/src/loader/mod.rs index 1f5cac6a..e81e9464 100644 --- a/yazi-plugin/src/loader/mod.rs +++ b/yazi-plugin/src/loader/mod.rs @@ -1,6 +1,6 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(loader, require); +yazi_macro::mod_flat!(loader require); pub(super) fn init() { LOADER.with(<_>::default); } diff --git a/yazi-plugin/src/process/mod.rs b/yazi-plugin/src/process/mod.rs index 7e7f746b..d2a48a7b 100644 --- a/yazi-plugin/src/process/mod.rs +++ b/yazi-plugin/src/process/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(child, command, output, process, status); +yazi_macro::mod_flat!(child command output process status); diff --git a/yazi-plugin/src/utils/mod.rs b/yazi-plugin/src/utils/mod.rs index c3f27ebb..984b8af3 100644 --- a/yazi-plugin/src/utils/mod.rs +++ b/yazi-plugin/src/utils/mod.rs @@ -1,5 +1,5 @@ #![allow(clippy::module_inception)] yazi_macro::mod_flat!( - app, cache, call, image, layer, log, preview, sync, target, text, time, user, utils + app cache call image layer log preview sync target text time user utils ); diff --git a/yazi-proxy/src/lib.rs b/yazi-proxy/src/lib.rs index 3a781ac4..5a565072 100644 --- a/yazi-proxy/src/lib.rs +++ b/yazi-proxy/src/lib.rs @@ -1,5 +1,5 @@ yazi_macro::mod_pub!(options); -yazi_macro::mod_flat!(app, completion, confirm, input, manager, select, semaphore, tab, tasks); +yazi_macro::mod_flat!(app completion confirm input manager pick semaphore tab tasks); pub fn init() { crate::init_semaphore(); } diff --git a/yazi-proxy/src/options/mod.rs b/yazi-proxy/src/options/mod.rs index def77466..8750391f 100644 --- a/yazi-proxy/src/options/mod.rs +++ b/yazi-proxy/src/options/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(notify, open, process, search); +yazi_macro::mod_flat!(notify open process search); diff --git a/yazi-proxy/src/select.rs b/yazi-proxy/src/pick.rs similarity index 56% rename from yazi-proxy/src/select.rs rename to yazi-proxy/src/pick.rs index 35fbfcb5..5375898b 100644 --- a/yazi-proxy/src/select.rs +++ b/yazi-proxy/src/pick.rs @@ -1,15 +1,15 @@ use tokio::sync::oneshot; -use yazi_config::popup::SelectCfg; +use yazi_config::popup::PickCfg; use yazi_macro::emit; use yazi_shared::{Layer, event::Cmd}; -pub struct SelectProxy; +pub struct PickProxy; -impl SelectProxy { +impl PickProxy { #[inline] - pub async fn show(cfg: SelectCfg) -> anyhow::Result { + pub async fn show(cfg: PickCfg) -> anyhow::Result { let (tx, rx) = oneshot::channel(); - emit!(Call(Cmd::new("show").with_any("tx", tx).with_any("cfg", cfg), Layer::Select)); + emit!(Call(Cmd::new("show").with_any("tx", tx).with_any("cfg", cfg), Layer::Pick)); rx.await? } } diff --git a/yazi-scheduler/src/file/mod.rs b/yazi-scheduler/src/file/mod.rs index fa26cdcb..2f172c12 100644 --- a/yazi-scheduler/src/file/mod.rs +++ b/yazi-scheduler/src/file/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(file, op); +yazi_macro::mod_flat!(file op); diff --git a/yazi-scheduler/src/lib.rs b/yazi-scheduler/src/lib.rs index 61a17f86..024cedce 100644 --- a/yazi-scheduler/src/lib.rs +++ b/yazi-scheduler/src/lib.rs @@ -1,8 +1,8 @@ #![allow(clippy::option_map_unit_fn, clippy::unit_arg)] -yazi_macro::mod_pub!(file, plugin, prework, process); +yazi_macro::mod_pub!(file plugin prework process); -yazi_macro::mod_flat!(ongoing, op, scheduler, task); +yazi_macro::mod_flat!(ongoing op scheduler task); const LOW: u8 = yazi_config::Priority::Low as u8; const NORMAL: u8 = yazi_config::Priority::Normal as u8; diff --git a/yazi-scheduler/src/plugin/mod.rs b/yazi-scheduler/src/plugin/mod.rs index 3b406fa1..be39901f 100644 --- a/yazi-scheduler/src/plugin/mod.rs +++ b/yazi-scheduler/src/plugin/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(op, plugin); +yazi_macro::mod_flat!(op plugin); diff --git a/yazi-scheduler/src/prework/mod.rs b/yazi-scheduler/src/prework/mod.rs index 89f57992..5e05d3d1 100644 --- a/yazi-scheduler/src/prework/mod.rs +++ b/yazi-scheduler/src/prework/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(op, prework); +yazi_macro::mod_flat!(op prework); diff --git a/yazi-scheduler/src/process/mod.rs b/yazi-scheduler/src/process/mod.rs index 70cdb6f9..6b2bd01d 100644 --- a/yazi-scheduler/src/process/mod.rs +++ b/yazi-scheduler/src/process/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(op, process, shell); +yazi_macro::mod_flat!(op process shell); diff --git a/yazi-shared/src/errors/mod.rs b/yazi-shared/src/errors/mod.rs index 4e9e4f21..7393a6da 100644 --- a/yazi-shared/src/errors/mod.rs +++ b/yazi-shared/src/errors/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(input, peek); +yazi_macro::mod_flat!(input peek); diff --git a/yazi-shared/src/event/mod.rs b/yazi-shared/src/event/mod.rs index 41bf7d0d..86f5ad3c 100644 --- a/yazi-shared/src/event/mod.rs +++ b/yazi-shared/src/event/mod.rs @@ -1,5 +1,5 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(cmd, data, event); +yazi_macro::mod_flat!(cmd data event); pub static NEED_RENDER: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); diff --git a/yazi-shared/src/fs/mod.rs b/yazi-shared/src/fs/mod.rs index b226c5c9..c8b18d8d 100644 --- a/yazi-shared/src/fs/mod.rs +++ b/yazi-shared/src/fs/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(cha, file, fns, loc, op, path, url, urn); +yazi_macro::mod_flat!(cha file fns loc op path url urn); diff --git a/yazi-shared/src/layer.rs b/yazi-shared/src/layer.rs index 525fc051..44df60a9 100644 --- a/yazi-shared/src/layer.rs +++ b/yazi-shared/src/layer.rs @@ -8,7 +8,7 @@ pub enum Layer { App, Manager, Tasks, - Select, + Pick, Input, Confirm, Help, @@ -22,7 +22,7 @@ impl Display for Layer { Self::App => "app", Self::Manager => "manager", Self::Tasks => "tasks", - Self::Select => "select", + Self::Pick => "pick", Self::Input => "input", Self::Confirm => "confirm", Self::Help => "help", @@ -40,7 +40,7 @@ impl FromStr for Layer { "app" => Self::App, "manager" => Self::Manager, "tasks" => Self::Tasks, - "select" => Self::Select, + "pick" => Self::Pick, "input" => Self::Input, "confirm" => Self::Confirm, "help" => Self::Help, diff --git a/yazi-shared/src/lib.rs b/yazi-shared/src/lib.rs index 77405a16..fd5b37be 100644 --- a/yazi-shared/src/lib.rs +++ b/yazi-shared/src/lib.rs @@ -1,10 +1,10 @@ #![allow(clippy::option_map_unit_fn)] -yazi_macro::mod_pub!(errors, event, fs, shell, theme, translit); +yazi_macro::mod_pub!(errors event fs shell theme translit); yazi_macro::mod_flat!( - chars, condition, debounce, env, layer, natsort, number, os, rand, ro_cell, terminal, throttle, - time, xdg + chars condition debounce env layer natsort number os rand ro_cell terminal throttle + time xdg ); pub fn init() { diff --git a/yazi-shared/src/theme/mod.rs b/yazi-shared/src/theme/mod.rs index 2f544ac5..4b4ca466 100644 --- a/yazi-shared/src/theme/mod.rs +++ b/yazi-shared/src/theme/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(color, icon, style); +yazi_macro::mod_flat!(color icon style); diff --git a/yazi-shared/src/translit/mod.rs b/yazi-shared/src/translit/mod.rs index 26abf734..356388c8 100644 --- a/yazi-shared/src/translit/mod.rs +++ b/yazi-shared/src/translit/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(table, traits); +yazi_macro::mod_flat!(table traits);