Skip to content

Commit

Permalink
chore: tidied up lualine config
Browse files Browse the repository at this point in the history
  • Loading branch information
tapayne88 committed Dec 29, 2024
1 parent 09ce6bc commit e61d1fd
Showing 1 changed file with 4 additions and 48 deletions.
52 changes: 4 additions & 48 deletions dot_config/nvim/lua/tap/plugins/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,6 @@ return {
return comp
end

---Copied from lualine.component and modified to allow empty status to render
---driver code of the class
---@param default_highlight string default hl group of section where component resides
---@param is_focused boolean|number whether drawing for active or inactive statusline.
---@return string stl formatted rendering string for component
local empty_draw = function(self, default_highlight, is_focused)
self.status = ''
self.applied_separator = ''
if self.options.cond ~= nil and self.options.cond() ~= true then
return self.status
end
self.default_hl = default_highlight
local status = self:update_status(is_focused)
if self.options.fmt then
status = self.options.fmt(status or '', self)
end
-- if type(status) == 'string' and #status > 0 then
self.status = status
self:apply_icon()
self:apply_padding()
self:apply_on_click()
self:apply_highlights(default_highlight)
self:apply_section_separators()
self:apply_separator()
-- end
return self.status
end

local filetype = require('lualine.components.filetype'):extend()
function filetype:draw(...)
return empty_draw(self, ...)
end

local diagnostic_empty = require('lualine.components.diagnostics'):extend()
function diagnostic_empty:draw(...)
return empty_draw(self, ...)
end

local function modified()
if vim.bo.modified then
return ''
Expand Down Expand Up @@ -123,7 +85,8 @@ return {

local diagnostic_section = function(cfg)
local default_cfg = {
diagnostic_empty,
'diagnostics',
draw_empty = true,
source = { 'nvim_diagnostic' },
separator = {
left = section_separators.right,
Expand Down Expand Up @@ -252,7 +215,8 @@ return {
lualine_y = {
literal ' ',
{
filetype,
'filetype',
draw_empty = true,
colored = false,
padding = 0,
fmt = function(status)
Expand Down Expand Up @@ -301,14 +265,6 @@ return {
local winbar_y = {
project_name(),
}
local filetype_icon_only = {
filetype,
colored = false,
padding = 0,
fmt = function()
return ''
end,
}

require('lualine').setup {
options = {
Expand Down

0 comments on commit e61d1fd

Please # to comment.