sodapopcan / vim-twiggy

Git branch management for Vim
280 stars 15 forks source link

Fugitive status buffer does not refresh after switching branches via twiggy #50

Open zivarah opened 6 months ago

zivarah commented 6 months ago

Description

Taking actions in twiggy (such as switching branches) does not trigger the fugitive status buffer to update automatically.

Given that twiggy is advertised as a fugitive extension, I had assumed that taking actions within twiggy would cause the fugitive status buffer to reload automatically. That doesn't seem to be the case -- I need to manually run :G or take some other action that would trigger a reload before fugitive, for example, updates to show the current branch to be the one I just switched to.

Would it make sense to trigger fugitive to reload the status buffer after various twiggy operations?

Steps to reproduce

  1. :G to open fugitive status buffer
  2. :Twiggy to open twiggy alongside fugitive
  3. <CR> over a different branch -- see that fugitive does not update and still shows the old branch as the head
  4. :G to force fugitive to update -- see that the branch you switched to now shows as the head
sodapopcan commented 6 months ago

I'm afraid this is one those "works on my machine" type scenarios. Can you share more info about your setup, like system and Vim (or Nvim) version? Perhaps also the code you're using for the status line?

zivarah commented 6 months ago

I'm afraid this is one those "works on my machine" type scenarios. Can you share more info about your setup, like system and Vim (or Nvim) version? Perhaps also the code you're using for the status line?

Of course -- apologies for not including more info initially, I was treating this like a feature request rather than a bug.

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable",
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

local plugins = {
    {
        "tpope/vim-fugitive",
        config = function() end,
    },
    {
        "sodapopcan/vim-twiggy",
        dependencies = {
            "tpope/vim-fugitive",
        },
    },
}

require("lazy").setup(plugins)
zivarah commented 6 months ago

Oh, and for good measure, these are the commits I'm running from:

sodapopcan commented 6 months ago

Thanks so much for the detailed report!

I will look into this in the next few days. I'm currently scrambling to find a new job so my vim plugin is not top of mind atm ;) but I'll take a look in the next week or so!