summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/ccomplete.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-01 20:46:49 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-01 20:46:49 +0000
commite344bead3ecc16a0982d157e8c19050f6dff4e0c (patch)
tree34da48120172b9e2efc8c559733c2b69db5a24ba /runtime/autoload/ccomplete.vim
parentda2303d96b0f55d30e9b5b57d3459d5e1ea22ec2 (diff)
updated for version 7.0140v7.0140
Diffstat (limited to 'runtime/autoload/ccomplete.vim')
-rw-r--r--runtime/autoload/ccomplete.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
new file mode 100644
index 0000000000..f699ca7582
--- /dev/null
+++ b/runtime/autoload/ccomplete.vim
@@ -0,0 +1,32 @@
+" Vim completion script
+" Language: C
+" Maintainer: Bram Moolenaar <Bram@vim.org>
+" Last Change: 2005 Sep 01
+
+function! ccomplete#Complete(findstart, base)
+ if a:findstart
+ " locate the start of the word
+ let line = getline('.')
+ let start = col('.') - 1
+ while start > 0
+ if line[start - 1] =~ '\w\|\.'
+ let start -= 1
+ elseif start > 1 && line[start - 2] == '-' && line[start - 1] == '>'
+ let start -= 2
+ else
+ break
+ endif
+ endwhile
+ return start
+ endif
+
+ " return list of matches
+ let items = split(a:base, '\.\|->')
+ if len(items) == 1
+ " Only one part, no "." or "->": complete from tags file.
+ let diclist = taglist(items[0])
+ return map(diclist, 'v:val["name"]')
+ endif
+ return items
+endfunction
+