Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check group in when toggling same ids #1538

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions autoload/go/guru.vim
Original file line number Diff line number Diff line change
Expand Up @@ -534,23 +534,30 @@ function! s:same_ids_highlight(exit_val, output) abort
endfunction

function! go#guru#ClearSameIds() abort
let l:cleared = -1

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

if l:cleared != 0
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