Reputation: 2319
I have just moved from ctags to gtags for my huge C Project. But I couldnt find any vim autocomplete plugin that works with gtags. gtags is so widely used and much more efficient than ctags. I am sure I am missing something here. Someone must have integrated gtags with any autocomplete plugin.
Upvotes: 1
Views: 956
Reputation: 1182
I've written a simple 'omnifunc'
for Vim, that uses GNU global
for completion:
augroup GlobalComplete
autocmd!
autocmd FileType c setlocal omnifunc=GlobalComplete
augroup END
function! GlobalComplete(findstart, base)
if a:findstart == 1
return s:LocateCurrentWordStart()
else
return split(system('global -c ' . a:base), '\n')
endif
endfunction
function! s:LocateCurrentWordStart()
let l:line = getline('.')
let l:start = col('.') - 1
while l:start > 0 && l:line[l:start - 1] =~# '\a'
let l:start -= 1
endwhile
return l:start
endfunction
See also:
Upvotes: 0
Reputation: 2319
I have to write my own plugin for this. Here is the link if someone needs it. https://github.com/kanwar-saad/gtagsomnicomplete
Upvotes: 0