| 1 |
-- Copyright (c) 2020-2021 shadmansaleh |
| 2 |
-- MIT license, see LICENSE for more details. |
| 3 |
local M = require('lualine.component'):extend() |
| 4 |
local modules = require('lualine_require').lazy_require { |
| 5 |
git_branch = 'lualine.components.branch.git_branch', |
| 6 |
highlight = 'lualine.highlight', |
| 7 |
utils = 'lualine.utils.utils', |
| 8 |
} |
| 9 |
|
| 10 |
-- Initializer |
| 11 |
M.init = function(self, options) |
| 12 |
M.super.init(self, options) |
| 13 |
if not self.options.icon then |
| 14 |
self.options.icon = '' -- e0a0 |
| 15 |
end |
| 16 |
modules.git_branch.init() |
| 17 |
end |
| 18 |
|
| 19 |
M.update_status = function(_, is_focused) |
| 20 |
local buf = (not is_focused and vim.api.nvim_get_current_buf()) |
| 21 |
local branch = modules.git_branch.get_branch(buf) |
| 22 |
return modules.utils.stl_escape(branch) |
| 23 |
end |
| 24 |
|
| 25 |
return M |