Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's ratio settings!
Assume the user's ratio is
-
min-parent: Toggles between$$0$$ and$$A$$ - the parent is either completely hidden or showed with width$$A$$ . -
max-parent: Toggles between$$A$$ and$$\infty$$ - the parent is either showed with width$$A$$ or fills the entire screen. -
min-current: Toggles between$$0$$ and$$B$$ - the current is either completely hidden or showed with width$$B$$ . -
max-current: Toggles between$$B$$ and$$\infty$$ - the current is either showed with width$$B$$ or fills the entire screen. -
min-preview: Toggles between$$0$$ and$$C$$ - the preview is either completely hidden or showed with width$$C$$ . -
max-preview: Toggles between$$C$$ and$$\infty$$ - the preview is either showed with width$$C$$ or fills the entire screen. -
reset: Resets to the user's configuredratio.
ya pkg add yazi-rs/plugins:toggle-paneHide/Show preview:
# keymap.toml
[[mgr.prepend_keymap]]
on = "T"
run = "plugin toggle-pane min-preview"
desc = "Show or hide the preview pane"Maximize/Restore preview:
# keymap.toml
[[mgr.prepend_keymap]]
on = "T"
run = "plugin toggle-pane max-preview"
desc = "Maximize or restore the preview pane"You can replace preview with current or parent to toggle the other panes.
Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other actions/plugins.
In addition to triggering the plugin with a keypress, you can also trigger it in your init.lua file:
if os.getenv("NVIM") then
require("toggle-pane"):entry("min-preview")
endIn the example above, when it detects that you're using Yazi in nvim, the preview is hidden by default — you can always press T (or any key you've bound) to show it again.
This plugin only maximizes the "available preview area", without actually changing the content size.
This means that the appearance of your preview largely depends on the previewer you are using. However, most previewers tend to make the most of the available space, so this usually isn't an issue.
For image previews, you may want to tune up the max_width and max_height options in your yazi.toml:
[preview]
# Change them to your desired values
max_width = 1000
max_height = 1000This plugin is MIT-licensed. For more information, check the LICENSE file.