refactor: LazyVim.config

This commit is contained in:
Folke Lemaitre 2024-06-16 15:35:38 +02:00
parent 57ef349910
commit 05e45e0d35
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
15 changed files with 32 additions and 42 deletions

View file

@ -27,7 +27,7 @@ return {
}
table.insert(opts.sections.lualine_x, 2, {
function()
local icon = require("lazyvim.config").icons.kinds.Copilot
local icon = LazyVim.config.icons.kinds.Copilot
local status = require("copilot.api").status.data
return icon .. (status.message or "")
end,

View file

@ -42,7 +42,7 @@ return {
optional = true,
event = "VeryLazy",
opts = function(_, opts)
local icon = require("lazyvim.config").icons.kinds.TabNine
local icon = LazyVim.config.icons.kinds.TabNine
table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("cmp_tabnine", icon))
end,
},

View file

@ -1,12 +1,10 @@
local Config = require("lazyvim.config")
return {
desc = "Aerial Symbol Browser",
{
"stevearc/aerial.nvim",
event = "LazyFile",
opts = function()
local icons = vim.deepcopy(Config.icons.kinds)
local icons = vim.deepcopy(LazyVim.config.icons.kinds)
-- HACK: fix lua's weird choice for `Package` for control
-- structures like if/else/for/etc.
@ -14,8 +12,8 @@ return {
---@type table<string, string[]>|false
local filter_kind = false
if Config.kind_filter then
filter_kind = assert(vim.deepcopy(Config.kind_filter))
if LazyVim.config.kind_filter then
filter_kind = assert(vim.deepcopy(LazyVim.config.kind_filter))
filter_kind._ = filter_kind.default
filter_kind.default = nil
end

View file

@ -30,7 +30,7 @@ end
local function symbols_filter(entry, ctx)
if ctx.symbols_filter == nil then
ctx.symbols_filter = require("lazyvim.config").get_kind_filter(ctx.bufnr) or false
ctx.symbols_filter = LazyVim.config.get_kind_filter(ctx.bufnr) or false
end
if ctx.symbols_filter == false then
return true

View file

@ -18,7 +18,7 @@ return {
separator = " ",
highlight = true,
depth_limit = 5,
icons = require("lazyvim.config").icons.kinds,
icons = LazyVim.config.icons.kinds,
lazy_update_context = true,
}
end,

View file

@ -12,7 +12,6 @@ return {
keys = { { "<leader>cs", "<cmd>Outline<cr>", desc = "Toggle Outline" } },
cmd = "Outline",
opts = function()
local Config = require("lazyvim.config")
local defaults = require("outline.config").defaults
local opts = {
symbols = {},
@ -22,14 +21,14 @@ return {
down_and_jump = "<down>",
},
}
local filter = Config.kind_filter
local filter = LazyVim.config.kind_filter
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,
icon = LazyVim.config.icons.kinds[kind] or symbol.icon,
hl = symbol.hl,
}
if not vim.tbl_contains(filter, kind) then

View file

@ -133,7 +133,7 @@ return {
"<leader>ss",
function()
require("telescope.builtin").lsp_document_symbols({
symbols = require("lazyvim.config").get_kind_filter(),
symbols = LazyVim.config.get_kind_filter(),
})
end,
desc = "Goto Symbol",
@ -142,7 +142,7 @@ return {
"<leader>sS",
function()
require("telescope.builtin").lsp_dynamic_workspace_symbols({
symbols = require("lazyvim.config").get_kind_filter(),
symbols = LazyVim.config.get_kind_filter(),
})
end,
desc = "Goto Symbol (Workspace)",