LazyVim.LazyVim/lua/lazyvim/plugins/extras/editor/outline.lua

62 lines
1.5 KiB
Lua
Raw Normal View History

return {
-- Disable `<leader>cs` keymap so it doesn't conflict with `outline.nvim`
{
"folke/trouble.nvim",
optional = true,
keys = {
{ "<leader>cs", false },
},
},
{
"hedyhli/outline.nvim",
keys = { { "<leader>cs", "<cmd>Outline<cr>", desc = "Toggle Outline" } },
cmd = "Outline",
opts = function()
local defaults = require("outline.config").defaults
local opts = {
fix(outline): use the correct symbols and filter config format (#3924) ## What is this PR for? The symbols-outline extra was removed in favor of outline.nvim in #2535 (thanks!), but the configuration for symbols in outline.nvim [is not backwards-compatible](https://github.com/hedyhli/outline.nvim/issues/12). This fixes the configuration for the symbols icons and filter to be usable by outline.nvim. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Does this PR fix an existing issue? <!-- If this PR fixes any issues, please link to the issue here. Fixes #<issue_number> --> It doesn't seem like anyone has encountered this issue, but I can confirm that the config currently used by LazyVim is incorrect. The symbols table is at `symbols` for symbols-outline.nvim, but it's now at `symbols.icons` for outline.nvim. There is no such `symbols_blacklist` key. Instead, `symbols.filter` is used, which is a kind of "whitelist". Coincidentally, outline.nvim fully supports the LazyVim `kind_filter` config table structure. It can either be a list of strings (kinds), or a list of strings for each filetype key. Setting to nil or false makes it so all symbols are included, just like in LazyVim. See [the docs on the `symbols.filter`](https://github.com/hedyhli/outline.nvim?tab=readme-ov-file#symbols-table) structure. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
2024-07-05 22:10:46 +08:00
symbols = {
icons = {},
filter = vim.deepcopy(LazyVim.config.kind_filter),
fix(outline): use the correct symbols and filter config format (#3924) ## What is this PR for? The symbols-outline extra was removed in favor of outline.nvim in #2535 (thanks!), but the configuration for symbols in outline.nvim [is not backwards-compatible](https://github.com/hedyhli/outline.nvim/issues/12). This fixes the configuration for the symbols icons and filter to be usable by outline.nvim. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Does this PR fix an existing issue? <!-- If this PR fixes any issues, please link to the issue here. Fixes #<issue_number> --> It doesn't seem like anyone has encountered this issue, but I can confirm that the config currently used by LazyVim is incorrect. The symbols table is at `symbols` for symbols-outline.nvim, but it's now at `symbols.icons` for outline.nvim. There is no such `symbols_blacklist` key. Instead, `symbols.filter` is used, which is a kind of "whitelist". Coincidentally, outline.nvim fully supports the LazyVim `kind_filter` config table structure. It can either be a list of strings (kinds), or a list of strings for each filetype key. Setting to nil or false makes it so all symbols are included, just like in LazyVim. See [the docs on the `symbols.filter`](https://github.com/hedyhli/outline.nvim?tab=readme-ov-file#symbols-table) structure. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
2024-07-05 22:10:46 +08:00
},
keymaps = {
up_and_jump = "<up>",
down_and_jump = "<down>",
},
}
fix(outline): use the correct symbols and filter config format (#3924) ## What is this PR for? The symbols-outline extra was removed in favor of outline.nvim in #2535 (thanks!), but the configuration for symbols in outline.nvim [is not backwards-compatible](https://github.com/hedyhli/outline.nvim/issues/12). This fixes the configuration for the symbols icons and filter to be usable by outline.nvim. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Does this PR fix an existing issue? <!-- If this PR fixes any issues, please link to the issue here. Fixes #<issue_number> --> It doesn't seem like anyone has encountered this issue, but I can confirm that the config currently used by LazyVim is incorrect. The symbols table is at `symbols` for symbols-outline.nvim, but it's now at `symbols.icons` for outline.nvim. There is no such `symbols_blacklist` key. Instead, `symbols.filter` is used, which is a kind of "whitelist". Coincidentally, outline.nvim fully supports the LazyVim `kind_filter` config table structure. It can either be a list of strings (kinds), or a list of strings for each filetype key. Setting to nil or false makes it so all symbols are included, just like in LazyVim. See [the docs on the `symbols.filter`](https://github.com/hedyhli/outline.nvim?tab=readme-ov-file#symbols-table) structure. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
2024-07-05 22:10:46 +08:00
for kind, symbol in pairs(defaults.symbols.icons) do
opts.symbols.icons[kind] = {
icon = LazyVim.config.icons.kinds[kind] or symbol.icon,
hl = symbol.hl,
}
end
return opts
end,
},
-- edgy integration
{
"folke/edgy.nvim",
optional = true,
opts = function(_, opts)
local edgy_idx = LazyVim.plugin.extra_idx("ui.edgy")
local symbols_idx = LazyVim.plugin.extra_idx("editor.outline")
if edgy_idx and edgy_idx > symbols_idx then
LazyVim.warn(
"The `edgy.nvim` extra must be **imported** before the `outline.nvim` extra to work properly.",
{ title = "LazyVim" }
)
end
opts.right = opts.right or {}
table.insert(opts.right, {
title = "Outline",
ft = "Outline",
pinned = true,
open = "Outline",
})
end,
},
}