Sunday, July 15, 2012

Re: vimdiff: displaying the total number of changes

Am 15.07.2012 22:48, schrieb Andy Wokula:
> " return the number of diff hunks
> func! DiffNumberOfChanges()
> let rhl = map(range(1, line("$")), 'diff_hlID(v:val, 1)')
> let hunks1 = strlen(substitute(
> \ substitute(join(rhl, "")."0", '[1-9]0', 'x', 'g'), '[^x]', '', 'g'))
> let hunks2 = len(filter(map(range(1, line("$")+1), 'diff_filler(v:val)'), 'v:val>=1'))
> return hunks1 + hunks2
> endfunc

I guess it's buggy when the diff_hlID is a multiple of 10, but you get the idea ...

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment