mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-23 22:15:28 +02:00
Merge pull request #2617 from bobbleclank/use-gitsigns-status-dict
Use gitsigns_status_dict instead of gitsigns_status
This commit is contained in:
commit
9007d19ab7
@ -28,16 +28,24 @@ function! s:coc_git_enabled() abort
|
|||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parse_hunk_status(hunks) abort
|
function! s:parse_hunk_status_dict(hunks) abort
|
||||||
|
let result = [0, 0, 0]
|
||||||
|
let result[0] = get(a:hunks, 'added', 0)
|
||||||
|
let result[1] = get(a:hunks, 'changed', 0)
|
||||||
|
let result[2] = get(a:hunks, 'removed', 0)
|
||||||
|
return result
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:parse_hunk_status_decorated(hunks) abort
|
||||||
if empty(a:hunks)
|
if empty(a:hunks)
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
let result = [0, 0, 0]
|
let result = [0, 0, 0]
|
||||||
for val in split(a:hunks)
|
for val in split(a:hunks)
|
||||||
if val[0] is# '+'
|
if val[0] is# '+'
|
||||||
let result[0] = val[1:] + 0
|
let result[0] = val[1:] + 0
|
||||||
elseif val[0] is# '~'
|
elseif val[0] is# '~'
|
||||||
let result[1] = val[1:] + 0
|
let result[1] = val[1:] + 0
|
||||||
elseif val[0] is# '-'
|
elseif val[0] is# '-'
|
||||||
let result[2] = val[1:] + 0
|
let result[2] = val[1:] + 0
|
||||||
endif
|
endif
|
||||||
@ -64,13 +72,13 @@ function! s:get_hunks_changes() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_hunks_gitsigns() abort
|
function! s:get_hunks_gitsigns() abort
|
||||||
let hunks = get(b:, 'gitsigns_status', '')
|
let hunks = get(b:, 'gitsigns_status_dict', {})
|
||||||
return s:parse_hunk_status(hunks)
|
return s:parse_hunk_status_dict(hunks)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_hunks_coc() abort
|
function! s:get_hunks_coc() abort
|
||||||
let hunks = get(b:, 'coc_git_status', '')
|
let hunks = get(b:, 'coc_git_status', '')
|
||||||
return s:parse_hunk_status(hunks)
|
return s:parse_hunk_status_decorated(hunks)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_hunks_empty() abort
|
function! s:get_hunks_empty() abort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user