2013-09-30 04:19:31 -04:00
|
|
|
" vim: et sw=2 sts=2
|
|
|
|
|
2013-08-19 11:36:16 -04:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2013-07-19 16:33:23 -04:00
|
|
|
" Function: #list_active_buffers {{{1
|
2013-07-17 06:30:58 -04:00
|
|
|
function! sy#debug#list_active_buffers() abort
|
2013-11-22 13:55:04 -05:00
|
|
|
for b in range(1, bufnr('$'))
|
2013-11-22 10:14:28 -05:00
|
|
|
if !buflisted(b) || empty(getbufvar(b, 'sy'))
|
2013-11-21 20:57:43 -05:00
|
|
|
continue
|
|
|
|
endif
|
2013-07-17 06:30:58 -04:00
|
|
|
|
2013-11-22 08:05:18 -05:00
|
|
|
let sy = copy(getbufvar(b, 'sy'))
|
2013-11-21 20:57:43 -05:00
|
|
|
let path = remove(sy, 'path')
|
2013-11-22 08:05:18 -05:00
|
|
|
|
2013-07-17 06:30:58 -04:00
|
|
|
echo "\n". path ."\n". repeat('=', strlen(path))
|
2014-09-18 07:11:33 -04:00
|
|
|
|
|
|
|
for k in ['active', 'buffer', 'type', 'stats', 'id_top']
|
|
|
|
if k == 'stats'
|
|
|
|
echo printf("%10s = %d added, %d changed, %d removed\n",
|
|
|
|
\ k,
|
|
|
|
\ sy.stats[0],
|
|
|
|
\ sy.stats[1],
|
|
|
|
\ sy.stats[2])
|
|
|
|
else
|
|
|
|
echo printf("%10s = %s\n", k, sy[k])
|
|
|
|
endif
|
2013-07-17 06:30:58 -04:00
|
|
|
endfor
|
2014-09-18 07:11:33 -04:00
|
|
|
|
|
|
|
if empty(sy.hunks)
|
|
|
|
echo printf("%10s = %s\n", 'hunks', '[]')
|
|
|
|
else
|
|
|
|
for i in range(len(sy.hunks))
|
|
|
|
if i == 0
|
|
|
|
echo printf("%10s = start: %d, end: %d, IDs: %s\n",
|
|
|
|
\ 'hunks',
|
|
|
|
\ sy.hunks[i].start,
|
|
|
|
\ sy.hunks[i].end,
|
|
|
|
\ string(sy.hunks[i].ids))
|
|
|
|
else
|
|
|
|
echo printf("%20s: %d, %s: %d, %s: %s\n",
|
|
|
|
\ 'start', sy.hunks[i].start,
|
|
|
|
\ 'end', sy.hunks[i].end,
|
|
|
|
\ 'IDs', string(sy.hunks[i].ids))
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
endif
|
2013-07-17 06:30:58 -04:00
|
|
|
endfor
|
|
|
|
endfunction
|
2015-05-24 04:40:18 -04:00
|
|
|
|
2015-05-26 04:59:29 -04:00
|
|
|
" Function: #verbose_diff_cmd {{{1
|
2015-05-24 04:40:18 -04:00
|
|
|
function! sy#debug#verbose_diff_cmd() abort
|
2015-05-24 04:52:28 -04:00
|
|
|
if exists('b:sy') && b:sy.type != 'unknown'
|
|
|
|
let output = sy#repo#get_diff_{b:sy.type}()[1]
|
2015-05-24 04:40:18 -04:00
|
|
|
echohl Statement
|
|
|
|
echo 'Command: '. b:sy_info.cmd
|
|
|
|
echohl NONE
|
|
|
|
if empty(output)
|
|
|
|
echo 'Output: []'
|
|
|
|
else
|
|
|
|
echo 'Output:'
|
|
|
|
for line in split(output, '\n')
|
|
|
|
if line[0] == '+'
|
|
|
|
echohl DiffAdd
|
|
|
|
elseif line[0] == '-'
|
|
|
|
echohl DiffDelete
|
|
|
|
else
|
|
|
|
echohl NONE
|
|
|
|
endif
|
|
|
|
echo line
|
|
|
|
echohl NONE
|
|
|
|
endfor
|
|
|
|
endif
|
2015-05-24 04:52:28 -04:00
|
|
|
else
|
|
|
|
echo 'signify: I cannot detect any changes!'
|
2015-05-24 04:40:18 -04:00
|
|
|
endif
|
|
|
|
endfunction
|