Skip to content

Commit

Permalink
feat(statusline): add some utility methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelot committed Feb 5, 2022
1 parent 43d6c30 commit cef435a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/heirline/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ function StatusLine:new(child)
return new
end

function StatusLine:broadcast(func)
for i, c in ipairs(self) do
func(c)
c:broadcast(func)
end
end

function StatusLine:make_ids(index)
local parent_id = self:nonlocal("id") or {}

Expand All @@ -78,6 +85,14 @@ function StatusLine:nonlocal(attr)
return getmetatable(self).__index(self, attr)
end


function StatusLine:local_(attr)
local orig_mt = getmetatable(self)
setmetatable(self, {})
local result = self[attr]
setmetatable(self, orig_mt)
return result
end
function StatusLine:set_win_attr(attr, val, default)
local winnr = self.winnr
self[attr] = self[attr] or {}
Expand Down

0 comments on commit cef435a

Please sign in to comment.