As stated in the title already: will there be any support for hunk plugins like signify or git-gutter? That's the only thing missing which keeps me away from lightline. Unfortunately I'm not able to configure lightline in a way that would satisfy my (simple) needs.
I've never used those two plugins. Please refer to the helps of those plugins. I do not know what gutter is but the function GitGutterGetHunkSummary might help you.
Even though closed I want to contribute my solution that I found together with the creator of vim-signify (mhinz).
He suggested to write a wrapper function around a signify function:
function! s:sy_stats_wrapper()
let symbols = ['+', '-', '~']
let [added, modified, removed] = sy#repo#get_stats()
let stats = [added, removed, modified] " reorder
let hunkline = ''
for i in range(3)
if stats[i] > 0
let hunkline .= printf('%s%s ', symbols[i], stats[i])
endif
endfor
if !empty(hunkline)
let hunkline = printf(' [%s]', hunkline[:-2])
endif
return hunkline
endfunction
That can be used then to be implemented in the statusline (be it your own statusline or from a statusline plugin like lightline) ...
I hope this is useful to someone.
Here's a similar function that includes the name of the VCS and reuses the same characters signify uses for the gutter.
It's also more compact, you can add spaces around the strings if it feels too cramped.
function! LightlineSignify()
let [added, modified, removed] = sy#repo#get_stats()
let l:sy = ''
for [flag, count] in [
\ [g:signify_sign_add, added],
\ [g:signify_sign_delete, removed],
\ [g:signify_sign_change, modified]
\ ]
if count > 0
let l:sy .= printf('%s%d', flag, count)
endif
endfor
if !empty(l:sy)
let l:sy = printf('[%s]', l:sy)
let l:sy_vcs = get(b:sy, 'updated_by', '???')
return printf('%s%s', l:sy_vcs, l:sy)
else
return ''
endif
endfunction
I had some problems getting @somini's function to work. Specifically, I did not have the global Signify variables defined, and I wasn't able to modify count.
Here's a slightly improved version of the function:
function! LightlineSignify()
let [added, modified, removed] = sy#repo#get_stats()
let l:sy = ''
for [flag, flagcount] in [
\ [exists("g:signify_sign_add")?g:signify_sign_add:'+', added],
\ [exists("g:signify_sign_delete")?g:signify_sign_delete:'-', removed],
\ [exists("g:signify_sign_change")?g:signify_sign_change:'!', modified]
\ ]
if flagcount> 0
let l:sy .= printf('%s%d', flag, flagcount)
endif
endfor
if !empty(l:sy)
let l:sy = printf('[%s]', l:sy)
let l:sy_vcs = get(b:sy, 'updated_by', '???')
return printf('%s%s', l:sy_vcs, l:sy)
else
return ''
endif
endfunction
Note that count is an exceptional variable name in Vim script. See :h l:.
Most helpful comment
Note that
countis an exceptional variable name in Vim script. See:h l:.