2021-10-11 11:42:47 +00:00
|
|
|
-- Copyright (c) 2020-2021 shadmansaleh
|
|
|
|
-- MIT license, see LICENSE for more details.
|
|
|
|
local M = require('lualine.component'):extend()
|
2022-02-15 17:17:05 +00:00
|
|
|
local modules = require('lualine_require').lazy_require {
|
|
|
|
git_branch = 'lualine.components.branch.git_branch',
|
|
|
|
highlight = 'lualine.highlight',
|
|
|
|
utils = 'lualine.utils.utils',
|
|
|
|
}
|
2021-10-11 11:42:47 +00:00
|
|
|
|
|
|
|
-- Initilizer
|
|
|
|
M.init = function(self, options)
|
|
|
|
M.super.init(self, options)
|
|
|
|
if not self.options.icon then
|
|
|
|
self.options.icon = '' -- e0a0
|
|
|
|
end
|
2022-02-15 17:17:05 +00:00
|
|
|
modules.git_branch.init()
|
2021-10-11 11:42:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
M.update_status = function(_, is_focused)
|
2022-02-15 17:17:05 +00:00
|
|
|
local buf = (not is_focused and vim.api.nvim_get_current_buf())
|
|
|
|
local branch = modules.git_branch.get_branch(buf)
|
|
|
|
return modules.utils.stl_escape(branch)
|
2021-10-11 11:42:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|