docs: updated generated docs

This commit is contained in:
Folke Lemaitre 2023-01-09 09:54:02 +01:00
parent c4b1408182
commit 6fdb06cd80
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 116 additions and 8 deletions

View file

@ -148,6 +148,8 @@ possible keymaps starting with `<space>`.
| `<leader>nl` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice Last Message | **n** |
| `<leader>nh` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice History | **n** |
| `<leader>na` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice All | **n** |
| `<c-f>` | [noice.nvim](https://github.com/folke/noice.nvim.git) Scroll forward | **n** |
| `<c-b>` | [noice.nvim](https://github.com/folke/noice.nvim.git) Scroll backward | **n** |
| `<leader>nd` | [nvim-notify](https://github.com/rcarriga/nvim-notify.git) Delete all Notifications | **n** |
| `<leader>sr` | [nvim-spectre](https://github.com/windwp/nvim-spectre.git) Replace in files (Spectre) | **n** |
| `<leader>qs` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Restore Session | **n** |
@ -196,10 +198,11 @@ possible keymaps starting with `<space>`.
<!-- plugins:start -->
<details><summary>Core Plugins</summary>
- [alpha-nvim](https://github.com/goolord/alpha-nvim)
- [catppuccin](https://github.com/catppuccin/nvim)
- [cmp-buffer](https://github.com/hrsh7th/cmp-buffer)
- [cmp-emoji](https://github.com/hrsh7th/cmp-emoji)
- [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp)
- [cmp-path](https://github.com/hrsh7th/cmp-path)
- [cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip)
@ -209,7 +212,6 @@ possible keymaps starting with `<space>`.
- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
- [lazy.nvim](https://github.com/folke/lazy.nvim)
- [LazyVim](https://github.com/LazyVim/LazyVim)
- [leap.nvim](https://github.com/ggandor/leap.nvim)
- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim)
- [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
@ -247,4 +249,64 @@ possible keymaps starting with `<space>`.
- [vim-startuptime](https://github.com/dstein64/vim-startuptime)
- [which-key.nvim](https://github.com/folke/which-key.nvim)
</details>
<details><summary>Extras: <code>lang.json</code></summary>
To use this, add it to your **lazy.nvim** imports:
```lua
require("lazy").setup({
spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "plugins" },
},
})
```
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- [schemastore.nvim](https://github.com/b0o/schemastore.nvim)
</details>
<details><summary>Extras: <code>lang.typescript</code></summary>
To use this, add it to your **lazy.nvim** imports:
```lua
require("lazy").setup({
spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "plugins" },
},
})
```
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- [typescript.nvim](https://github.com/jose-elias-alvarez/typescript.nvim)
</details>
<details><summary>Extras: <code>ui.mini-starter</code></summary>
To use this, add it to your **lazy.nvim** imports:
```lua
require("lazy").setup({
spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
{ import = "plugins" },
},
})
```
- [mini.starter](https://github.com/echasnovski/mini.starter)
</details>
<!-- plugins:end -->

View file

@ -1,9 +1,11 @@
-- Ugly code to generate some things for the readme
local Util = require("lazy.util")
local M = {}
local root = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h:h")
---@return ReadmeBlock
function M.keymaps()
local root = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h:h")
local keymap_set = vim.keymap.set
---@type table<string,{mode?:string|string[], keys:string, desc?:string, i:number, group:string}>
local keymaps = {}
@ -42,7 +44,7 @@ function M.keymaps()
group = "Plugins"
require("lazy.util").foreach(require("lazy.core.config").plugins, function(name, plugin)
Util.foreach(require("lazy.core.config").plugins, function(name, plugin)
for _, key in ipairs(plugin.keys or {}) do
if type(key) == "table" and key.desc then
local desc = key.desc or ""
@ -85,14 +87,58 @@ function M.keymaps()
lines[#lines + 1] = "</details>"
lines[#lines + 1] = ""
end
return table.concat(lines, "\n")
return { content = table.concat(lines, "\n") }
end
function M.update()
local Docs = require("lazy.docs")
Docs.plugins()
Docs.save({ keymaps = M.keymaps() })
vim.cmd.checktime()
---@type table<string, ReadmeBlock>
local data = {
keymaps = M.keymaps(),
}
local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" })
---@type string[]
local plugins = {
"<details><summary>Core Plugins</summary>",
"",
Docs.plugins(core.plugins).content,
"",
"</details>",
"",
}
Util.walk(root .. "/lua/lazyvim/plugins/extras", function(path, name, type)
if type == "file" and name:find("%.lua$") then
local modname = path:gsub(".*/lua/", ""):gsub("/", "."):gsub("%.lua$", "")
local spec = require("lazy.core.plugin").Spec.new({ import = modname })
spec:fix_disabled()
vim.list_extend(plugins, {
("<details><summary>Extras: <code>%s</code></summary>"):format(modname:gsub(".*extras%.", "")),
"",
([[
To use this, add it to your **lazy.nvim** imports:
```lua
require("lazy").setup({
spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" },
{ import = "%s" },
{ import = "plugins" },
},
})
```
]]):format(modname),
Docs.plugins(spec.plugins).content,
"",
"</details>",
"",
})
end
end)
data.plugins = { content = table.concat(plugins, "\n") }
Docs.save(data)
end
M.update()