Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty line and git syntax diff highlights #81

Closed
Sangdol opened this issue Feb 5, 2022 · 1 comment
Closed

Empty line and git syntax diff highlights #81

Sangdol opened this issue Feb 5, 2022 · 1 comment

Comments

@Sangdol
Copy link

Sangdol commented Feb 5, 2022

Hello Tim Pope,

First of all, thanks a lot for your contribution to this project and other vim plugins. You're making the world a better place.

I've noticed that the git and gitcommit syntax for gitDiffAdded and gitDiffRemoved don't work if an empty space is added in the code section, for example,

gitDiff doesn't work with an empty space

I looked into the git.vim syntax file and found out that it works if I make a small change in the gitDiff syntax by deleting the \!$ in the end condition like these:

" From
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff

" To
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\)\@=/ contains=@gitDiff fold
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \)\@=/ contains=@gitDiff

After fixing the syntax:

after fixing gitDiff syntax

I don't think this is the right way to fix this issue and am wondering if this is an issue only for me.

Could you explain why this is happening?

Thanks.

@tpope
Copy link
Owner

tpope commented Feb 6, 2022

It deliberately terminates on a blank line because that's what separates it from the next commit in git log -p.

@tpope tpope closed this as completed Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants