feat(config): make kind filter configurable for telescope/aerial/...
This commit is contained in:
@ -84,6 +84,26 @@ local defaults = {
|
|||||||
Variable = " ",
|
Variable = " ",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
---@type table<string, string[]>?
|
||||||
|
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 = {
|
M.json = {
|
||||||
@ -167,6 +187,17 @@ function M.setup(opts)
|
|||||||
Util.track()
|
Util.track()
|
||||||
end
|
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"
|
---@param name "autocmds" | "options" | "keymaps"
|
||||||
function M.load(name)
|
function M.load(name)
|
||||||
local function _load(mod)
|
local function _load(mod)
|
||||||
|
@ -150,42 +150,20 @@ return {
|
|||||||
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
||||||
{
|
{
|
||||||
"<leader>ss",
|
"<leader>ss",
|
||||||
Util.telescope("lsp_document_symbols", {
|
function()
|
||||||
symbols = {
|
require("telescope.builtin").lsp_document_symbols({
|
||||||
"Class",
|
symbols = require("lazyvim.config").get_kind_filter(),
|
||||||
"Function",
|
})
|
||||||
"Method",
|
end,
|
||||||
"Constructor",
|
|
||||||
"Interface",
|
|
||||||
"Module",
|
|
||||||
"Struct",
|
|
||||||
"Trait",
|
|
||||||
"Field",
|
|
||||||
"Property",
|
|
||||||
"Enum",
|
|
||||||
"Constant",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
desc = "Goto Symbol",
|
desc = "Goto Symbol",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>sS",
|
"<leader>sS",
|
||||||
Util.telescope("lsp_dynamic_workspace_symbols", {
|
function()
|
||||||
symbols = {
|
require("telescope.builtin").lsp_dynamic_workspace_symbols({
|
||||||
"Class",
|
symbols = require("lazyvim.config").get_kind_filter(),
|
||||||
"Function",
|
})
|
||||||
"Method",
|
end,
|
||||||
"Constructor",
|
|
||||||
"Interface",
|
|
||||||
"Module",
|
|
||||||
"Struct",
|
|
||||||
"Trait",
|
|
||||||
"Field",
|
|
||||||
"Property",
|
|
||||||
"Enum",
|
|
||||||
"Constant",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
desc = "Goto Symbol (Workspace)",
|
desc = "Goto Symbol (Workspace)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user