diff --git a/lua/lualine/components/branch.lua b/lua/lualine/components/branch.lua index ad3c77b..38a4199 100644 --- a/lua/lualine/components/branch.lua +++ b/lua/lualine/components/branch.lua @@ -1,6 +1,5 @@ -- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -local utils = require('lualine.utils.utils') local Branch = require('lualine.component'):new() -- vars Branch.git_branch = '' @@ -21,17 +20,13 @@ Branch.new = function(self, options, child) end -- run watch head on load so branch is present when component is loaded Branch.find_git_dir() - -- update branch state of BufEnter as different Buffer may be on different repos - utils.define_autocmd('BufEnter', "lua require'lualine.components.branch'.find_git_dir()") return new_branch end Branch.update_status = function(_, is_focused) if Branch.active_bufnr ~= vim.g.actual_curbuf then - -- Workaround for https://github.com/hoob3rt/lualine.nvim/issues/286 - -- See upstream issue https://github.com/neovim/neovim/issues/15300 - -- Diff is out of sync re sync it. - Branch.update_branch() + -- Sync buffer + Branch.find_git_dir() end if not is_focused then return branch_cache[vim.fn.bufnr()] or '' end return Branch.git_branch diff --git a/lua/lualine/components/diff.lua b/lua/lualine/components/diff.lua index 6911c38..4efe0b1 100644 --- a/lua/lualine/components/diff.lua +++ b/lua/lualine/components/diff.lua @@ -109,7 +109,6 @@ Diff.new = function(self, options, child) if Diff.diff_checker_enabled then -- setup internal source - utils.define_autocmd('BufEnter', "lua require'lualine.components.diff'.update_diff_args()") utils.define_autocmd('BufWritePost', "lua require'lualine.components.diff'.update_git_diff()") Diff.update_diff_args() end @@ -122,9 +121,7 @@ Diff.update_status = function(self, is_focused) local git_diff if Diff.diff_checker_enabled then if Diff.active_bufnr ~= vim.g.actual_curbuf then - -- Workaround for https://github.com/hoob3rt/lualine.nvim/issues/286 - -- See upstream issue https://github.com/neovim/neovim/issues/15300 - -- Diff is out of sync re sync it. + -- Sync buffer Diff.update_diff_args() end git_diff = Diff.git_diff