neovim: remove git_status from lualine

This commit is contained in:
2023-04-29 22:58:45 +03:00
parent fe189fc524
commit 5b2d9cab21

View File

@@ -1,34 +1,6 @@
local lualine = require("lualine")
local devicons = require("nvim-web-devicons")
local gstatus = { ahead = 0, behind = 0 }
local function update_gstatus()
local Job = require("plenary.job")
Job:new({
command = "git",
args = { "rev-list", "--left-right", "--count", "HEAD...@{upstream}" },
on_exit = function(job, _)
local res = job:result()[1]
if type(res) ~= "string" then
gstatus = { ahead = 0, behind = 0 }
return
end
local ok, ahead, behind = pcall(string.match, res, "(%d+)%s*(%d+)")
if not ok then
ahead, behind = 0, 0
end
gstatus = { ahead = ahead, behind = behind }
end,
}):start()
end
if _G.Gstatus_timer == nil then
_G.Gstatus_timer = vim.loop.new_timer()
else
_G.Gstatus_timer:stop()
end
_G.Gstatus_timer:start(0, 2000, vim.schedule_wrap(update_gstatus))
local mode = {
"mode",
}
@@ -121,12 +93,6 @@ local diff = {
"diff",
}
local git_status = {
function()
return "" .. gstatus.ahead .. "" .. gstatus.behind .. ""
end,
}
lualine.setup({
options = {
component_separators = "",
@@ -147,7 +113,7 @@ lualine.setup({
sections = {
lualine_a = { mode },
lualine_b = { branch },
lualine_c = { diagnostics, git_status },
lualine_c = { diagnostics },
lualine_x = { diff, location, tabstop, fileformat },
lualine_y = { filetype },
lualine_z = {},