sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.74k stars 105 forks source link

Draw empty winbar in one side if other has winbar #348

Closed ArtAndreev closed 1 year ago

ArtAndreev commented 1 year ago

I face the next problem: I have barbecue installed, that draws winbar. When I start diffview against HEAD and another revision or just against another revision (the same case, I guess), I have the right side with a winbar drawn, because right side is a buffer with LSP-server attached. The left side doesn't has a winbar:

image

The diff between two sides isn't aligned. The workaround is to disable barbecue with :Barbecue toggle, but it's not convenient.

I think, one of the possible solutions can be to set a winbar in the left side to some empty string, so it's drawn as empty line and content is aligned.

sindrets commented 1 year ago

Try:

require("diffview").setup({
  view = {
    default = {
      winbar_info = true,
    },
    file_history = {
      winbar_info = true,
    },
  },
})
ArtAndreev commented 1 year ago

It works, thanks!

Result image

Can it be activated in smart way?

sindrets commented 1 year ago

What do you mean "smart way"? You put that snippet in your config.

ArtAndreev commented 1 year ago

Plugin may detect winbar in the right side (vim.o.winbar) and add winbar to the left side automatically, if it is missing.

ArtAndreev commented 1 year ago

Maybe it should activate these two options automatically, for example.

sindrets commented 1 year ago

Ah, I see what you mean. No, I strongly dislike "smart" options. They lead to unpredictable behavior.

If you want diffview to set the winbar, we have an option for it, and you can set it in your own config.

ArtAndreev commented 1 year ago

Understood, thanks for the help!