On Wed, Feb 13, 2013 at 10:50:28AM -0800, Nathan Hüsken wrote:
> Hey,
> 
> I am currently trying to improve the clang_complete plugin to have a global 
> notion of symbols.
> One thing I would like to do is highlighting all occurences of the symbol 
> under the cursor.

If you're ok with the highlighting being window-local, I briefly toyed
with something like the following to mimic Eclipse's automatic
"highlight the word under the cursor" functionality.

  hi link AutomaticWord IncSearch
  function! TransientMatch(word)
    if exists('w:matchid')
      call matchdelete(w:matchid)
    endif
    let w:matchid = matchadd('AutomaticWord', '\<'.a:word.'\>', -1)
  endfunction
  augroup TransientMatch
    autocmd!
    autocmd CursorHold * call TransientMatch(expand('<cword>'))
  augroup END

Since this is triggered by CursorHold, you'd also want to lower
'updatetime' to a value that's not too slow.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]>

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui