mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Extract uniq function.
This commit is contained in:
@@ -3,12 +3,7 @@ let s:t_string = type('')
|
||||
" Primary functions {{{
|
||||
|
||||
function! gitgutter#all(force) abort
|
||||
let processed = {}
|
||||
for bufnr in tabpagebuflist()
|
||||
if has_key(processed, bufnr)
|
||||
continue
|
||||
endif
|
||||
let processed[bufnr] = 1
|
||||
for bufnr in s:uniq(tabpagebuflist())
|
||||
let file = expand('#'.bufnr.':p')
|
||||
if !empty(file)
|
||||
call gitgutter#init_buffer(bufnr)
|
||||
@@ -63,12 +58,7 @@ function! gitgutter#disable() abort
|
||||
call extend(buflist, tabpagebuflist(i + 1))
|
||||
endfor
|
||||
|
||||
let processed = {}
|
||||
for bufnr in buflist
|
||||
if has_key(processed, bufnr)
|
||||
continue
|
||||
endif
|
||||
let processed[bufnr] = 1
|
||||
for bufnr in s:uniq(buflist)
|
||||
let file = expand('#'.bufnr.':p')
|
||||
if !empty(file)
|
||||
call s:clear(bufnr)
|
||||
@@ -107,3 +97,13 @@ function! s:clear(bufnr)
|
||||
call gitgutter#hunk#reset(a:bufnr)
|
||||
call s:reset_tick(a:bufnr)
|
||||
endfunction
|
||||
|
||||
function! s:uniq(list)
|
||||
let processed = []
|
||||
for e in a:list
|
||||
if index(a:list, e) == -1
|
||||
call add(a:list, e)
|
||||
endif
|
||||
endfor
|
||||
return processed
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user