This Yazi plugin enables multiple previewers per previewer entry. One can specify the previewers to cycle through and a keybinding that triggers the cycle. It uses the args to determine which previewers to call and calls the current previewers peek and seek methods accordingly.
Credits to @sxyazi for the idea (see issue comment).
ya pkg add peterfication/muxprepend_previewers = [
{ name = "*.csv", run = "mux code file" },
# ...
][mgr]
prepend_keymap = [
{ on = "p", run = "mux next", desc = "Show next previewer" },
# ...
]| Option | Default | Description |
|---|---|---|
notify_on_switch |
false |
Whether to show a notification when the previewer is switched. |
remember_per_file_extension |
false |
If false, the current previewer is remembered per file (per session). If true, the current previewer is remembered per suffix, so e.g. each JSON file will be previewed with the last selected previewer for JSON files. NOTE: this is without mime types yet, so folders and files without an extension will be treated the same, which will lead to unexpected behavior. |
aliases |
{} |
See "Use cases" for examples on how to use it. |
NOTE: Setup is only required if you want to change from the defaults.
require("mux"):setup({
notify_on_switch = true, -- Default: false
remember_per_file_extension = true, -- Default: false
aliases = {}, -- Default: {}
})(Like with the eza-preview.yazi plugin)
NOTE: Requires the piper plugin.
Explanations:
cdbeforeezamakes sure that the root does not contain the full pathLS_COLORSpaints executables green, like yazi
-- init.lua
require("mux"):setup({
aliases = {
eza_tree_1 = {
previewer = "piper",
args = {
'cd "$1" && LS_COLORS="ex=32" eza --oneline --tree --level 1 --color=always --icons=always --group-directories-first --no-quotes .',
},
},
eza_tree_2 = {
previewer = "piper",
args = {
'cd "$1" && LS_COLORS="ex=32" eza --oneline --tree --level 2 --color=always --icons=always --group-directories-first --no-quotes .',
},
},
eza_tree_3 = {
previewer = "piper",
args = {
'cd "$1" && LS_COLORS="ex=32" eza --oneline --tree --level 3 --color=always --icons=always --group-directories-first --no-quotes .',
},
},
eza_tree_4 = {
previewer = "piper",
args = {
'cd "$1" && LS_COLORS="ex=32" eza --oneline --tree --level 4 --color=always --icons=always --group-directories-first --no-quotes .',
},
},
},
})# yazi.toml
[mgr]
prepend_previewers = [
{ name = "*/", run = "mux eza_tree_1 eza_tree_2 eza_tree_3 eza_tree_4" },
# ...
]# keymap.toml
[mgr]
prepend_keymap = [
# Plugin: mux
{ on = "P", run = "plugin mux next", desc = "Cycle through mux previewers" },
# ...
]NOTE: Requires the duckdb plugin.
prepend_previewers = [
{ name = "*.csv", run = "mux duckdb code" },
{ name = "*.tsv", run = "mux duckdb code" },
{ name = "*.json", run = "mux duckdb code" },
# ...
]# keymap.toml
[mgr]
prepend_keymap = [
# Plugin: mux
{ on = "P", run = "plugin mux next", desc = "Cycle through mux previewers" },
# ...
]- Support spotters
- Support fetchers?
Useful just commands are defined in the Justfile.
just ciThis project is licensed under the MIT license (LICENSE or opensource.org/licenses/MIT)