[vim/vim] Missaligned tab stops in .diff and .patch files (#8366)

1 view
Skip to first unread message

Timothy Madden

unread,
Jun 11, 2021, 1:15:26 PM6/11/21
to vim/vim, Subscribed

Describe the bug
In a .diff or .patch file, tab stops within the text appear off-by-one

To Reproduce
Open a .diff or .patch file that uses tabs. Because diff inserts a new column at character position 1, for the '+', '-' and ' ' characters, tab stops in the rest of the content show up wrong

Expected behavior
In a .diff or .patch files, tab stops should start in column 2 instead of column 1. So instead of having tab stops in columns 1, 8, 16, 24, 32..., they should be in columns 2, 9, 17, 25, 33...

Screenshots
image

gitattributes.diff.gz

Environment (please complete the following information):

  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 12 2019 13:19:27)

Additional context
Only affects .diff and .patch files


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Jun 11, 2021, 1:55:18 PM6/11/21
to vim/vim, Subscribed

I think you can do this with ":set vartabstop=1,8".

Timothy Madden

unread,
Jun 11, 2021, 2:18:17 PM6/11/21
to vim/vim, Subscribed

Yes, thank you, that fixed my .diffs

I am not sure I understand the logic, though, my understanding would be
that I need vartabstop=7,8.

It would be nice if you could make this fix the default for .diff and
.patch files.

Otherwise this ticket should now be solved.
And thank you for such a great text editor!

On Fri, Jun 11, 2021 at 8:55 PM Bram Moolenaar ***@***.***>
wrote:


> I think you can do this with ":set vartabstop=1,8".
>
> —
> You are receiving this because you authored the thread.

> Reply to this email directly, view it on GitHub
> <https://github.com/vim/vim/issues/8366#issuecomment-859745924>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAC4QLD7YVFEDBWYRB4M7F3TSJEXJANCNFSM46REJMPQ>
> .

Bram Moolenaar

unread,
Jun 11, 2021, 2:22:27 PM6/11/21
to vim/vim, Subscribed

It's not that easy, some diff files have a two character margin. We could perhaps detect that.

Bram Moolenaar

unread,
Jun 11, 2021, 2:22:28 PM6/11/21
to vim/vim, Subscribed

Closed #8366.

Reply all
Reply to author
Forward
0 new messages