@@ -563,37 +563,60 @@ color for |hl-Normal| but for |hl-SignColumn|. To avoid that visible difference:
563563==============================================================================
564564FAQ *signify-faq*
565565
566- |signify-faq-01| What about vim-flagship support ?
566+ |signify-faq-01| How to display changes in the statusline ?
567567 |signify-faq-02| The plugin is slow!
568568 |signify-faq-03| Line highlighting without showing signs?
569569
570570------------------------------------------------------------------------------
571571 *signify-faq-01*
572- What about vim-flagship support ?~
572+ How to display changes in the statusline ?~
573573
574- sy#repo#get_stats() returns a list with 3 integers for added, modified and
575- removed lines. Create a wrapper function around it and return a string:
574+ Use either of the following two functions. Both take an optional buffer number
575+ and default to the current one.
576+
577+ - sy#repo#get_stats(...)~
578+
579+ Returns a list with the number of added, modified, and removed lines.
580+
581+ - sy#repo#get_stats_decorated(...)~
582+
583+ Similar to sy#repo#get_stats(), but with added decorations.
584+ Example: "[+3 -8 ~5]"
585+
586+ Using 'statusline':
587+ >
588+ function! MyStatusline()
589+ return ' %f '. sy#repo#get_stats_decorated()
590+ endfunction
591+
592+ set statusline=%!MyStatusline()
593+ <
594+ The above is the short form of:
576595>
577596 function! s:sy_stats_wrapper()
578- let symbols = ['+', '-', '~']
579597 let [added, modified, removed] = sy#repo#get_stats()
598+ let symbols = ['+', '-', '~']
580599 let stats = [added, removed, modified] " reorder
581- let hunkline = ''
600+ let statline = ''
582601
583602 for i in range(3)
584603 if stats[i] > 0
585- let hunkline .= printf('%s%s ', symbols[i], stats[i])
604+ let statline .= printf('%s%s ', symbols[i], stats[i])
586605 endif
587606 endfor
588607
589- if !empty(hunkline )
590- let hunkline = printf('[%s]', hunkline [:-2])
608+ if !empty(statline )
609+ let statline = printf('[%s]', statline [:-2])
591610 endif
592611
593- return hunkline
612+ return statline
613+ endfunction
614+
615+ function! MyStatusline()
616+ return ' %f '. s:sy_stats_wrapper()
594617 endfunction
595618
596- autocmd User Flags call Hoist('buffer', function('s:sy_stats_wrapper') )
619+ set statusline=%!MyStatusline( )
597620<
598621------------------------------------------------------------------------------
599622 *signify-faq-02*
0 commit comments