4

is there a way to number the lines that are different in vimdiff? Is there a way to count the lines that are different in vimdiff?

2
  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Mar 10, 2021 at 15:58
  • 1
    If you need to indicate something about the version of your vim or what is supported, you can edit the question body to do so; tags can be discussed on Vi and Vim Meta
    – D. Ben Knoble
    Mar 10, 2021 at 19:54

1 Answer 1

1

You can see which lines are different in diff mode:

echo filter(range(1, line('$')), 'diff_hlID(v:val, 1) == hlID("DiffChange") || diff_hlID(v:val, 1) == hlID("DiffText")')
3
  • How do I use this? When I put this on the command line this is what I see :>echo filter(range(1, line('$')), 'diff_hlID(v:val, 1) == hlID("DiffChange") || diff_hlID(v:val, 1) == hlID("DiffText")') bash: syntax error near unexpected token (' `.
    – cokedude
    Mar 10, 2021 at 16:41
  • When I put this in vim this is what I see E117: Unknown function: range E116: Invalid arguments for function filter(range(1, line('$')), 'diff_hlID(v:va l, 1) == hlID("DiffChange") || diff_hlID(v:val, 1) == hlID("DiffText")') E15: Invalid expression: filter(range(1, line('$')), 'diff_hlID(v:val, 1) == hlI D("DiffChange") || diff_hlID(v:val, 1) == hlID("DiffText")') Hit ENTER or type command to continue .
    – cokedude
    Mar 10, 2021 at 16:41
  • @cokedude it works for me, maybe your vim version is too old?
    – Biggybi
    Apr 4, 2022 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.