Skip to content

Commit

Permalink
re-evaluate sameids after a rename
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Aug 8, 2016
1 parent e7f5e57 commit 5aa1e3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions autoload/go/guru.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
" guru.vim -- Vim integration for the Go guru.

let s:sameid = 0

func! s:RunGuru(mode, format, selected, needs_scope) range abort
"return with a warning if the binary doesn't exist
Expand Down Expand Up @@ -364,15 +365,28 @@ function! go#guru#SameIds(selected)
let pos = split(item, ':')
call matchaddpos('goSameId', [[str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]])
endfor

let s:sameid = 1
endfunction

function! go#guru#SameIdRenamed()
if s:sameid
call go#guru#SameIds(-1)
endif
endfunction

function! go#guru#ClearSameIds()
if !s:sameid
return
endif

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

function! go#guru#ToggleSameIds(selected)
Expand Down
2 changes: 2 additions & 0 deletions autoload/go/rename.vim
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function! go#rename#Rename(bang, ...)
" we need a way to get the list of changes from gorename upon an success
" change.
silent execute ":e"

call go#guru#SameIdRenamed()
endfunction

" vim: sw=2 ts=2 et

0 comments on commit 5aa1e3d

Please sign in to comment.