diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index b3146eef..217f0d53 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -84,6 +84,26 @@ local defaults = { Variable = "󰀫 ", }, }, + ---@type table? + kind_filter = { + default = { + "Class", + "Constructor", + "Enum", + "Field", + "Function", + "Interface", + "Method", + "Module", + "Property", + "Struct", + "Trait", + }, + -- you can specify a different filter for each filetype + -- lua = { + -- "Function", + -- }, + }, } M.json = { @@ -167,6 +187,17 @@ function M.setup(opts) Util.track() end +---@param buf? number +---@return string[]? +function M.get_kind_filter(buf) + buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf + local ft = vim.bo[buf].filetype + if M.kind_filter == false then + return + end + return M.kind_filter[ft] or M.kind_filter.default +end + ---@param name "autocmds" | "options" | "keymaps" function M.load(name) local function _load(mod) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index e2c08b98..6e1d63b6 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -150,42 +150,20 @@ return { { "uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" }, { "ss", - Util.telescope("lsp_document_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - "Enum", - "Constant", - }, - }), + function() + require("telescope.builtin").lsp_document_symbols({ + symbols = require("lazyvim.config").get_kind_filter(), + }) + end, desc = "Goto Symbol", }, { "sS", - Util.telescope("lsp_dynamic_workspace_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - "Enum", - "Constant", - }, - }), + function() + require("telescope.builtin").lsp_dynamic_workspace_symbols({ + symbols = require("lazyvim.config").get_kind_filter(), + }) + end, desc = "Goto Symbol (Workspace)", }, },