diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 84163165..19686b57 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -92,7 +92,7 @@ local defaults = { Variable = "󰀫 ", }, }, - ---@type table? + ---@type table? kind_filter = { default = { "Class", @@ -109,6 +109,8 @@ local defaults = { "Struct", "Trait", }, + markdown = false, + help = false, -- you can specify a different filter for each filetype lua = { "Class", @@ -214,7 +216,11 @@ function M.get_kind_filter(buf) if M.kind_filter == false then return end - return M.kind_filter[ft] or M.kind_filter.default + if M.kind_filter[ft] == false then + return + end + ---@diagnostic disable-next-line: return-type-mismatch + return type(M.kind_filter) == "table" and type(M.kind_filter.default) == "table" and M.kind_filter.default or nil end ---@param name "autocmds" | "options" | "keymaps" diff --git a/lua/lazyvim/plugins/extras/editor/symbols-outline.lua b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua index f0b0ba92..32cdd17f 100644 --- a/lua/lazyvim/plugins/extras/editor/symbols-outline.lua +++ b/lua/lazyvim/plugins/extras/editor/symbols-outline.lua @@ -12,14 +12,20 @@ return { symbols = {}, symbol_blacklist = {}, } + local filter = Config.kind_filter - for kind, symbol in pairs(defaults.symbols) do - opts.symbols[kind] = { - icon = Config.icons.kinds[kind] or symbol.icon, - hl = symbol.hl, - } - if not vim.tbl_contains(Config.kind_filter.default, kind) then - table.insert(opts.symbol_blacklist, kind) + if type(filter) == "table" then + filter = filter.default + if type(filter) == "table" then + for kind, symbol in pairs(defaults.symbols) do + opts.symbols[kind] = { + icon = Config.icons.kinds[kind] or symbol.icon, + hl = symbol.hl, + } + if not vim.tbl_contains(filter, kind) then + table.insert(opts.symbol_blacklist, kind) + end + end end end return opts