docs: add advanced usage example for hide-preview.yazi

This commit is contained in:
sxyazi
2024-08-18 21:51:57 +08:00
parent a3ee7173bf
commit 49ec78e68a

View File

@@ -22,3 +22,16 @@ desc = "Hide or show preview"
```
Make sure the <kbd>T</kbd> key is not used elsewhere.
## Advanced
In addition to triggering the plugin with a keypress, you can also trigger it in your `init.lua` file:
```lua
if os.getenv("NVIM") then
require("hide-preview"):entry()
end
```
In the example above, when it detects that you're [using Yazi in nvim](https://github.com/mikavilpas/yazi.nvim), the
preview is hidden by default - you can always press `T` (or any key you've bound) to display it again.