1- *builtin.txt* For Vim version 9.1. Last change: 2025 Apr 18
1+ *builtin.txt* For Vim version 9.1. Last change: 2025 Apr 27
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -129,11 +129,14 @@ charidx({string}, {idx} [, {countcc} [, {utf16}]])
129129chdir({dir} ) String change current working directory
130130cindent({lnum} ) Number C indent for line {lnum}
131131clearmatches([{win} ]) none clear all matches
132+ cmdcomplete_info() Dict get current cmdline completion
133+ information
132134col({expr} [, {winid} ]) Number column byte index of cursor or mark
133135complete({startcol} , {matches} ) none set Insert mode completion
134136complete_add({expr} ) Number add completion match
135137complete_check() Number check for key typed during completion
136138complete_info([{what} ]) Dict get current completion information
139+ complete_match([{lnum} , {col} ]) List get completion column and trigger text
137140confirm({msg} [, {choices} [, {default} [, {type} ]]])
138141 Number number of choice picked by user
139142copy({expr} ) any make a shallow copy of {expr}
@@ -1832,6 +1835,29 @@ clearmatches([{win}]) *clearmatches()*
18321835 Return type: | Number |
18331836
18341837
1838+ cmdcomplete_info() *cmdcomplete_info()*
1839+ Returns a | Dictionary | with information about cmdline
1840+ completion. See | cmdline-completion | .
1841+ The items are:
1842+ cmdline_orig The original command-line string before
1843+ completion began.
1844+ pum_visible | TRUE | if popup menu is visible.
1845+ See | pumvisible() | .
1846+ matches List of all completion candidates. Each item
1847+ is a string.
1848+ selected Selected item index. First index is zero.
1849+ Index is -1 if no item is selected (showing
1850+ typed text only, or the last completion after
1851+ no item is selected when using the <Up> or
1852+ <Down> keys)
1853+
1854+ Returns an empty | Dictionary | if no completion was attempted,
1855+ if there was only one candidate and it was fully completed, or
1856+ if an error occurred.
1857+
1858+ Return type: dict<any>
1859+
1860+
18351861col({expr} [, {winid} ]) *col()*
18361862 The result is a Number, which is the byte index of the column
18371863 position given with {expr} .
@@ -2007,6 +2033,50 @@ complete_info([{what}]) *complete_info()*
20072033<
20082034 Return type: dict<any>
20092035
2036+ complete_match([{lnum} , {col} ]) *complete_match()*
2037+ Searches backward from the given position and returns a List
2038+ of matches according to the 'isexpand' option. When no
2039+ arguments are provided, uses the current cursor position.
2040+
2041+ Each match is represented as a List containing
2042+ [startcol, trigger_text] where:
2043+ - startcol: column position where completion should start,
2044+ or -1 if no trigger position is found. For multi-character
2045+ triggers, returns the column of the first character.
2046+ - trigger_text: the matching trigger string from 'isexpand' ,
2047+ or empty string if no match was found or when using the
2048+ default 'iskeyword' pattern.
2049+
2050+ When 'isexpand' is empty, uses the 'iskeyword' pattern
2051+ "\k\+$" to find the start of the current keyword.
2052+
2053+ Examples: >
2054+ set isexpand=.,->,/,/*,abc
2055+ func CustomComplete()
2056+ let res = complete_match()
2057+ if res->len() == 0 | return | endif
2058+ let [col, trigger] = res[0]
2059+ let items = []
2060+ if trigger == '/*'
2061+ let items = ['/** */']
2062+ elseif trigger == '/'
2063+ let items = ['/*! */', '// TODO:', '// fixme:']
2064+ elseif trigger == '.'
2065+ let items = ['length()']
2066+ elseif trigger =~ '^\->'
2067+ let items = ['map()', 'reduce()']
2068+ elseif trigger =~ '^\abc'
2069+ let items = ['def', 'ghk']
2070+ endif
2071+ if items->len() > 0
2072+ let startcol = trigger =~ '^/' ? col : col + len(trigger)
2073+ call complete(startcol, items)
2074+ endif
2075+ endfunc
2076+ inoremap <Tab> <Cmd>call CustomComplete()<CR>
2077+ <
2078+ Return type: list<list<any> >
2079+
20102080 *confirm()*
20112081confirm({msg} [, {choices} [, {default} [, {type} ]]])
20122082 confirm() offers the user a dialog, from which a choice can be
@@ -3235,7 +3305,8 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
32353305 Can also be used as a | method | : >
32363306 GetName()->finddir()
32373307<
3238- Return type: | String |
3308+ Return type: list<string> if {count} is negative, | String |
3309+ otherwise
32393310
32403311
32413312findfile({name} [, {path} [, {count} ]]) *findfile()*
@@ -3249,7 +3320,8 @@ findfile({name} [, {path} [, {count}]]) *findfile()*
32493320 Can also be used as a | method | : >
32503321 GetName()->findfile()
32513322<
3252- Return type: | String |
3323+ Return type: list<string> if {count} is negative, | String |
3324+ otherwise
32533325
32543326
32553327flatten({list} [, {maxdepth} ]) *flatten()*
@@ -4243,6 +4315,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
42434315 file file and directory names
42444316 file_in_path file and directory names in | 'path' |
42454317 filetype filetype names | 'filetype' |
4318+ filetypecmd | :filetype | suboptions
42464319 function function name
42474320 help help subjects
42484321 highlight highlight groups
0 commit comments