nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.71k stars 455 forks source link

Bug: Extensions are not working #1262

Open daUnknownCoder opened 3 weeks ago

daUnknownCoder commented 3 weeks ago

Self Checks

How to reproduce the problem

Expected behaviour

Extensions should show the required stuff

Actual behaviour

image so it somehow shows the inactive_sections data as:

require("lualine").setup({ inactive_sections = { lualine_a = {"filename"}, lualine_z = {"progress"} } })

with lazy:

return {
  "nvim-lualine/lualine.nvim",
  lazy = false,
  opts = { disabled_filetypes = {}, extensions = {"lazy","nvim-tree","alpha"} },
}

Additional information

i dont have inactive_sections configured like they arent in my config anywhere

My config (click) oh and if u see the `disabled_filetypes` thing, i did that out of spite ```lua return { "nvim-lualine/lualine.nvim", event = { "VeryLazy", "LazyFile" }, init = function() vim.g.lualine_laststatus = vim.o.laststatus if vim.fn.argc(-1) > 0 then vim.o.statusline = " " else vim.o.laststatus = 0 end end, config = function() local lualine_status_ok, lualine = pcall(require, "lualine") if not lualine_status_ok then print("Unable to load Lualine!") end local icons_ok, icons = pcall(require, "NeutronVim.core.icons") if not icons_ok then print("Unable to import icons!") end -- Custom Filename local custom_fname = require("lualine.components.filename"):extend() local highlight = require("lualine.highlight") local default_status_colors = { saved = "#50fa7b", modified = "#ff5555" } function custom_fname:init(options) custom_fname.super.init(self, options) self.status_colors = { saved = highlight.create_component_highlight_group( { fg = default_status_colors.saved }, "filename_status_saved", self.options ), modified = highlight.create_component_highlight_group( { fg = default_status_colors.modified }, "filename_status_modified", self.options ), } if self.options.color == nil then self.options.color = "" end end function custom_fname:update_status() local data = custom_fname.super.update_status(self) data = highlight.component_format_highlight( vim.bo.modified and self.status_colors.modified or self.status_colors.saved ) .. data return data end local hide_in_width = function() return vim.fn.winwidth(0) > 80 end vim.o.laststatus = vim.g.lualine_laststatus lualine.setup({ options = { theme = "auto", globalstatus = vim.o.laststatus == 3, -- stylua: ignore disabled_filetypes = { "dashboard", "lspinfo", "mason", "startuptime", "checkhealth", "help", "toggleterm", "alpha", "lazy", "packer", "NvimTree", "sagaoutline", "TelescopePrompt", }, component_separators = { right = "", left = "" }, section_separators = { right = "", left = "" }, always_divide_middle = true, }, sections = { lualine_a = { { "mode", icon = " 󰊠", separator = { left = "█", right = "" }, padding = { left = 0, right = 1 }, }, }, lualine_b = { { "branch", icon = icons.git.Branch, padding = { left = 2, right = 1 }, }, }, lualine_c = { { "diagnostics", symbols = { Error = icons.diagnostics.Error .. " ", Warn = icons.diagnostics.Warning .. " ", Hint = icons.diagnostics.Hint .. " ", Info = icons.diagnostics.Info .. " ", }, }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, { custom_fname, symbols = { modified = " " .. icons.ui.Pencil, readonly = " " .. icons.ui.Lock, unnamed = " [None] ", newfile = " " .. icons.documents.File, }, path = 0, padding = { left = 0, right = 1 }, }, { function() local lint_progress = function() local linters = require("lint").get_running() if #linters == 0 then return " 󰦕 Linting completed " end return " 󱉶 Linting in progress " end return lint_progress() end, cond = function() if not package.loaded.lint then return false end return true end, padding = { left = 0, right = 0 }, }, { "%=", "%t%m", "%3p", "%=", separator = "" }, "%=", { function() local msg = "No Active Lsp" local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") local clients = vim.lsp.get_active_clients() if next(clients) == nil then return msg end for _, client in ipairs(clients) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end end return msg end, icon = icons.ui.TripleGear .. "LSP:", color = { fg = "#ffffff" }, }, }, lualine_x = { "%=", { require("noice").api.statusline.mode.get, cond = require("noice").api.statusline.mode.has, color = { fg = "#ff9e64" }, }, { function() return icons.ui.Bug .. require("dap").status() end, cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, }, { "diff", symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " ", }, diff_color = { added = { fg = "#50fa7b" }, modified = { fg = "#f1fa8c" }, removed = { fg = "#ff5555" }, }, cond = hide_in_width, }, { require("noice").api.status.command.get, cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, color = { fg = "#ff9e64" }, }, { require("lazy.status").updates, cond = require("lazy.status").has_updates, color = { fg = "#ff9e64" }, on_click = function() vim.cmd(":Lazy") end, }, }, lualine_y = { { function() -- stylua: ignore start if vim.api.nvim_eval_statusline("%l", {}).str == "1" then return "0%%" elseif vim.api.nvim_eval_statusline("%l", {}).str == "100" then return "100%%" end return vim.api.nvim_eval_statusline("%p", {}).str .. "%%" -- stylua: ignore end end, separator = " ", padding = { left = 1, right = 0 }, }, { function() return vim.api.nvim_eval_statusline("%l│%L:%c│%-2{col('$') - 1}", {}).str end, padding = { left = 0, right = 1 }, }, }, lualine_z = { { function() local function format_file_size(file) local size = vim.fn.getfsize(file) if size <= 0 then return "" end local sufixes = { " B", " KB", " MB", " GB" } local i = 1 while size > 1024 do size = size / 1024 i = i + 1 end return string.format("%.1f%s", size, sufixes[i]) end local file = vim.fn.expand("%:p") if string.len(file) == 0 then return "" end return format_file_size(file) end, color = { fg = "lightgreen", bg = "#0F1416" }, separator = { left = "" }, }, { "datetime", style = " %X", separator = { right = "█", left = "" }, }, }, }, extensions = { "lazy", "nvim-tree" }, }) require("lualine").hide({ place = { "tabline", "winbar" }, unhide = false, }) end, } ```