initial
This commit is contained in:
58
.config/nvim/lua/user/heirline.lua
Normal file
58
.config/nvim/lua/user/heirline.lua
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
local Git = {
|
||||
condition = conditions.is_git_repo,
|
||||
|
||||
init = function(self)
|
||||
self.status_dict = vim.b.gitsigns_status_dict
|
||||
self.has_changes = self.status_dict.added ~= 0 or self.status_dict.removed ~= 0 or self.status_dict.changed ~= 0
|
||||
end,
|
||||
|
||||
hl = { fg = "orange" },
|
||||
|
||||
{ -- git branch name
|
||||
provider = function(self)
|
||||
return " " .. self.status_dict.head
|
||||
end,
|
||||
hl = { bold = true },
|
||||
},
|
||||
-- You could handle delimiters, icons and counts similar to Diagnostics
|
||||
{
|
||||
condition = function(self)
|
||||
return self.has_changes
|
||||
end,
|
||||
provider = "(",
|
||||
},
|
||||
{
|
||||
provider = function(self)
|
||||
local count = self.status_dict.added or 0
|
||||
return count > 0 and ("+" .. count)
|
||||
end,
|
||||
hl = { fg = "git_add" },
|
||||
},
|
||||
{
|
||||
provider = function(self)
|
||||
local count = self.status_dict.removed or 0
|
||||
return count > 0 and ("-" .. count)
|
||||
end,
|
||||
hl = { fg = "git_del" },
|
||||
},
|
||||
{
|
||||
provider = function(self)
|
||||
local count = self.status_dict.changed or 0
|
||||
return count > 0 and ("~" .. count)
|
||||
end,
|
||||
hl = { fg = "git_change" },
|
||||
},
|
||||
{
|
||||
condition = function(self)
|
||||
return self.has_changes
|
||||
end,
|
||||
provider = ")",
|
||||
},
|
||||
}
|
||||
|
||||
local statusline = { Git }
|
||||
local winbar = {}
|
||||
local tabline = {}
|
||||
|
||||
require("heirline").setup(statusline, winbar, tabline)
|
||||
Reference in New Issue
Block a user