Skip to content

Commit

Permalink
Merge pull request #1538 from 'tmatias:toggle_same_ids_check_group'
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Oct 29, 2017
2 parents 0878992 + ee76970 commit 5a3a231
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions autoload/go/guru.vim
Original file line number Diff line number Diff line change
Expand Up @@ -533,24 +533,33 @@ function! s:same_ids_highlight(exit_val, output) abort
endif
endfunction

" ClearSameIds returns 0 when it removes goSameId groups and non-zero if no
" goSameId groups are found.
function! go#guru#ClearSameIds() abort
let l:cleared = 0

let m = getmatches()
for item in m
if item['group'] == 'goSameId'
call matchdelete(item['id'])
let l:cleared = 1
endif
endfor

if !l:cleared
return 1
endif

" remove the autocmds we defined
if exists("#BufWinEnter#<buffer>")
autocmd! BufWinEnter <buffer>
endif

return 0
endfunction

function! go#guru#ToggleSameIds() abort
if len(getmatches()) != 0
call go#guru#ClearSameIds()
else
if go#guru#ClearSameIds() != 0
call go#guru#SameIds()
endif
endfunction
Expand Down

0 comments on commit 5a3a231

Please sign in to comment.