From 416ff9a18f4fd54ce3828647316def3a508f31d8 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Mon, 27 May 2024 22:26:12 +0300 Subject: [PATCH] docs: plugin manager docs start with a tutorial --- documentation/plugin-manager.md | 58 ++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/documentation/plugin-manager.md b/documentation/plugin-manager.md index ef09f17..56cf459 100644 --- a/documentation/plugin-manager.md +++ b/documentation/plugin-manager.md @@ -1,14 +1,62 @@ # The yazi.nvim plugin manager -Yazi.nvim ships with _experimental plugin manager_ support for lazy.nvim. Its -purpose is to provide users a way to fully manage their yazi and neovim plugins -from inside neovim. +Yazi.nvim ships with _experimental plugin manager_ support for lazy.nvim. It +allows you to fully manage your yazi and neovim plugins from inside neovim. + +## Getting started + +In this example, we will install the yazi plugin +[DreamMaoMao/keyjump.yazi](https://github.com/DreamMaoMao/keyjump.yazi), which +adds a "jump-to-line" feature to yazi. + +In your yazi.nvim configuration, add a new lazy.nvim plugin specification for +`DreamMaoMao/keyjump.yazi`: + +```lua +-- this file is: /Users/mikavilpas/.config/nvim/lua/plugins/my-file-manager.lua +---@type LazySpec +return { + { + "mikavilpas/yazi.nvim", + dependencies = { "nvim-lua/plenary.nvim", }, + keys = { + { + "", + function() + require("yazi").yazi() + end, + }, + }, + }, + { + "DreamMaoMao/keyjump.yazi", + lazy = true, + build = function(plugin) + require("yazi.plugin").build_plugin(plugin) + end, + }, +} +``` + +Make sure to add the `lazy` and `build` keys to the plugin specification +(lazy.nvim +[documentation](https://github.com/folke/lazy.nvim?tab=readme-ov-file#-plugin-spec)). + +Next, run `:Lazy` in neovim to install the plugin. + +Finally, add a keybinding to your `~/.config/yazi/keymap.toml` according to the +instructions provided by the plugin author. + +You're all set! You can now use the new plugin in yazi, and update it using +lazy.nvim. > Demo: installing a new Yazi plugin with lazy.nvim, and then using `l` > to view its commits +## How it works + The way it works is the following: - in your `lazy.nvim` configuration, you add the plugins you want to install @@ -46,7 +94,9 @@ As the Yazi plugin system is currently in beta, the yazi.nvim plugin manager is subject to change. Users seeking stability are encouraged to use the official plugin manager. -## How to use it +## More technical details + +> Note: this section is for advanced users. Add the following to your lazy.nvim configuration: