11" Vim completion script
22" Language: C
33" Maintainer: Bram Moolenaar <[email protected] >4- " Last Change: 2020 Apr 08
4+ " Last Change: 2020 Nov 14
55
66let s: cpo_save = &cpo
77set cpo &vim
88
99" This function is used for the 'omnifunc' option.
10- function ! ccomplete#Complete (findstart, base)
10+ func ccomplete#Complete (findstart, base)
1111 if a: findstart
1212 " Locate the start of the item, including ".", "->" and "[...]".
1313 let line = getline (' .' )
@@ -244,7 +244,7 @@ function! ccomplete#Complete(findstart, base)
244244 return map (res , ' s:Tagline2item(v:val, brackets)' )
245245endfunc
246246
247- function ! s: GetAddition (line , match , memarg, bracket)
247+ func s: GetAddition (line , match , memarg, bracket)
248248 " Guess if the item is an array.
249249 if a: bracket && match (a: line , a: match . ' \s*\[' ) > 0
250250 return ' ['
@@ -260,13 +260,13 @@ function! s:GetAddition(line, match, memarg, bracket)
260260 endif
261261 endif
262262 return ' '
263- endfunction
263+ endfunc
264264
265265" Turn the tag info "val" into an item for completion.
266266" "val" is is an item in the list returned by taglist().
267267" If it is a variable we may add "." or "->". Don't do it for other types,
268268" such as a typedef, by not including the info that s:GetAddition() uses.
269- function ! s: Tag2item (val)
269+ func s: Tag2item (val)
270270 let res = {' match' : a: val [' name' ]}
271271
272272 let res [' extra' ] = s: Tagcmd2extra (a: val [' cmd' ], a: val [' name' ], a: val [' filename' ])
@@ -289,10 +289,10 @@ function! s:Tag2item(val)
289289 endif
290290
291291 return res
292- endfunction
292+ endfunc
293293
294294" Use all the items in dictionary for the "info" entry.
295- function ! s: Dict2info (dict )
295+ func s: Dict2info (dict )
296296 let info = ' '
297297 for k in sort (keys (a: dict ))
298298 let info .= k . repeat (' ' , 10 - len (k ))
@@ -307,7 +307,7 @@ function! s:Dict2info(dict)
307307endfunc
308308
309309" Parse a tag line and return a dictionary with items like taglist()
310- function ! s: ParseTagline (line )
310+ func s: ParseTagline (line )
311311 let l = split (a: line , " \t " )
312312 let d = {}
313313 if len (l ) >= 3
@@ -334,12 +334,12 @@ function! s:ParseTagline(line)
334334 endif
335335
336336 return d
337- endfunction
337+ endfunc
338338
339339" Turn a match item "val" into an item for completion.
340340" "val['match']" is the matching item.
341341" "val['tagline']" is the tagline in which the last part was found.
342- function ! s: Tagline2item (val, brackets)
342+ func s: Tagline2item (val, brackets)
343343 let line = a: val [' tagline' ]
344344 let add = s: GetAddition (line , a: val [' match' ], [a: val ], a: brackets == ' ' )
345345 let res = {' word' : a: val [' match' ] . a: brackets . add }
@@ -377,10 +377,10 @@ function! s:Tagline2item(val, brackets)
377377 let res [' menu' ] = s: Tagcmd2extra (s , a: val [' match' ], matchstr (line , ' [^\t]*\t\zs[^\t]*\ze\t' ))
378378 endif
379379 return res
380- endfunction
380+ endfunc
381381
382382" Turn a command from a tag line to something that is useful in the menu
383- function ! s: Tagcmd2extra (cmd, name, fname)
383+ func s: Tagcmd2extra (cmd, name, fname)
384384 if a: cmd = ~ ' ^/^'
385385 " The command is a search command, useful to see what it is.
386386 let x = matchstr (a: cmd , ' ^/^\s*\zs.*\ze$/' )
@@ -395,13 +395,13 @@ function! s:Tagcmd2extra(cmd, name, fname)
395395 let x = a: cmd . ' - ' . a: fname
396396 endif
397397 return x
398- endfunction
398+ endfunc
399399
400400" Find composing type in "lead" and match items[0] with it.
401401" Repeat this recursively for items[1], if it's there.
402402" When resolving typedefs "depth" is used to avoid infinite recursion.
403403" Return the list of matches.
404- function ! s: Nextitem (lead, items , depth, all )
404+ func s: Nextitem (lead, items , depth, all )
405405
406406 " Use the text up to the variable name and split it in tokens.
407407 let tokens = split (a: lead , ' \s\+\|\<' )
@@ -485,15 +485,15 @@ function! s:Nextitem(lead, items, depth, all)
485485 endfor
486486
487487 return res
488- endfunction
488+ endfunc
489489
490490
491491" Search for members of structure "typename" in tags files.
492492" Return a list with resulting matches.
493493" Each match is a dictionary with "match" and "tagline" entries.
494494" When "all" is non-zero find all, otherwise just return 1 if there is any
495495" member.
496- function ! s: StructMembers (typename , items , all )
496+ func s: StructMembers (typename , items , all )
497497 " Todo: What about local structures?
498498 let fnames = join (map (tagfiles (), ' escape(v:val, " \\#%")' ))
499499 if fnames == ' '
@@ -586,12 +586,12 @@ function! s:StructMembers(typename, items, all)
586586
587587 " Failed to find anything.
588588 return []
589- endfunction
589+ endfunc
590590
591591" For matching members, find matches for following items.
592592" When "all" is non-zero find all, otherwise just return 1 if there is any
593593" member.
594- function ! s: SearchMembers (matches, items , all )
594+ func s: SearchMembers (matches, items , all )
595595 let res = []
596596 for i in range (len (a: matches ))
597597 let typename = ' '
0 commit comments