1" Vim completion script
2" Language:	C
3" Maintainer:	Bram Moolenaar <[email protected]>
4" Last Change:	2005 Sep 01
5
6function! ccomplete#Complete(findstart, base)
7  if a:findstart
8    " locate the start of the word
9    let line = getline('.')
10    let start = col('.') - 1
11    while start > 0
12      if line[start - 1] =~ '\w\|\.'
13	let start -= 1
14      elseif start > 1 && line[start - 2] == '-' && line[start - 1] == '>'
15	let start -= 2
16      else
17	break
18      endif
19    endwhile
20    return start
21  endif
22
23  " return list of matches
24  let items = split(a:base, '\.\|->')
25  if len(items) == 1
26    " Only one part, no "." or "->": complete from tags file.
27    let diclist = taglist(items[0])
28    return map(diclist, 'v:val["name"]')
29  endif
30  return items
31endfunction
32
33