Giter Club home page Giter Club logo

Comments (3)

tpope avatar tpope commented on June 3, 2024 1

The reason the highlighting is getting screwed up is because the option diff is being set in the status window, causing all 3 to be diffed. When I check verbose set diff? in the status window after the fact I see this:

  diff                                                                                                                                                                                
        Last set from Lua

So what is happening is that you're invoking stage_hunk from gitsigns.nvim, which is written in Lua, and then some Lua code is setting an option that screws up the highlighting.

Fugitive has no Lua code. Meanwhile, have a look at this Lua code from gitsigns.nvim:

  for _, w in ipairs(api.nvim_list_wins()) do
    if api.nvim_win_is_valid(w) then
      local b = api.nvim_win_get_buf(w)
      local bname = api.nvim_buf_get_name(b)
      if bname == bufname or vim.startswith(bname, 'fugitive://') then
        if should_reload(b) then
          api.nvim_buf_call(b, function()
            vim.cmd.doautocmd('BufReadCmd')
            vim.cmd.diffthis()
          end)
        end
      end
    end

Note in particular the check for vim.startswith(bname, 'fugitive://') (which matches the status window) and the invocation of vim.cmd.diffthis() (which turns on the diff option).

This is very straightforwardly 100% a Gitsigns issue.

from vim-fugitive.

tpope avatar tpope commented on June 3, 2024 1

You might find vim.fn.FugitiveParse(bname) helpful. Try :echo FugitiveParse(bufname()) in each of the fugitive:// buffers to see how it works.

from vim-fugitive.

m-demare avatar m-demare commented on June 3, 2024

Thanks for pointing me in the right direction!
I'll try to fix it and send a PR to gitsigns

from vim-fugitive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.