Closed Tinku10 closed 7 months ago
Ahh, wild, this has to do with how the git cli prints things. Those diffs are rendered pretty much straight from the CLI output - we parse that and show it. So, tabstop/shifwidth/friends wouldn't really have a big impact as it's not a buffer in the traditional sense. I think the easiest thing to do here is to just replace tabs when we render the diff. Lemme see how that works.
Ok, I don't think there's much I can do about this and be "right" in all cases. Vim is rendering the tabs according to tabstop
s value, and I'm just not sure what I could do to "force" it to be right. I was able to reproduce this where I had a buffer that had a mix of indentations, both tabs and spaces. Even though they did line up in the buffer, in neogit they didn't. Off by one. Which makes sense: In neogit, there's a +
at the beginning of the line, which I think the tabs would quietly ignore, while the spaces would not.
If you have any clever ideas, I'm open to it, but otherwise I think there's not anything to do here.
Description
It seems like Neogit is adjusting the indentation of the displayed diffs to 1 unit, no matter the default indentation level of the code base.
Neovim version
NVIM v0.9.4 Build type: Release LuaJIT 2.1.1700008891
Operating system and version
macOS 13.1
Steps to reproduce
gofmt
.Expected behavior
The indentations should align.
Actual behavior
The indentations are different making it seem like the about to be committed code has been misaligned.
I am using Go in a codebase and it turns out that
gofmt
enforcestabs
overspaces
. But there seems to be a difference in the interpretation of the tab width between Neovim and Neogit. From the image below you can see that the alignment does not look right in the Neogit Status panel.If the code is manually aligned with spaces, this does not raise this inconsistency. But almost everyone would use
gofmt
for Go formatting making this a nuisance.Minimal config