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
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -129,11 +129,14 @@ charidx({string}, {idx} [, {countcc} [, {utf16}]])
129
129
chdir({dir} ) String change current working directory
130
130
cindent({lnum} ) Number C indent for line {lnum}
131
131
clearmatches([{win} ]) none clear all matches
132
+ cmdcomplete_info() Dict get current cmdline completion
133
+ information
132
134
col({expr} [, {winid} ]) Number column byte index of cursor or mark
133
135
complete({startcol} , {matches} ) none set Insert mode completion
134
136
complete_add({expr} ) Number add completion match
135
137
complete_check() Number check for key typed during completion
136
138
complete_info([{what} ]) Dict get current completion information
139
+ complete_match([{lnum} , {col} ]) List get completion column and trigger text
137
140
confirm({msg} [, {choices} [, {default} [, {type} ]]])
138
141
Number number of choice picked by user
139
142
copy({expr} ) any make a shallow copy of {expr}
@@ -1832,6 +1835,29 @@ clearmatches([{win}]) *clearmatches()*
1832
1835
Return type: | Number |
1833
1836
1834
1837
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
+
1835
1861
col({expr} [, {winid} ]) *col()*
1836
1862
The result is a Number, which is the byte index of the column
1837
1863
position given with {expr} .
@@ -2007,6 +2033,50 @@ complete_info([{what}]) *complete_info()*
2007
2033
<
2008
2034
Return type: dict<any>
2009
2035
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
+
2010
2080
*confirm()*
2011
2081
confirm({msg} [, {choices} [, {default} [, {type} ]]])
2012
2082
confirm() offers the user a dialog, from which a choice can be
@@ -3235,7 +3305,8 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
3235
3305
Can also be used as a | method | : >
3236
3306
GetName()->finddir()
3237
3307
<
3238
- Return type: | String |
3308
+ Return type: list<string> if {count} is negative, | String |
3309
+ otherwise
3239
3310
3240
3311
3241
3312
findfile({name} [, {path} [, {count} ]]) *findfile()*
@@ -3249,7 +3320,8 @@ findfile({name} [, {path} [, {count}]]) *findfile()*
3249
3320
Can also be used as a | method | : >
3250
3321
GetName()->findfile()
3251
3322
<
3252
- Return type: | String |
3323
+ Return type: list<string> if {count} is negative, | String |
3324
+ otherwise
3253
3325
3254
3326
3255
3327
flatten({list} [, {maxdepth} ]) *flatten()*
@@ -4243,6 +4315,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
4243
4315
file file and directory names
4244
4316
file_in_path file and directory names in | 'path' |
4245
4317
filetype filetype names | 'filetype' |
4318
+ filetypecmd | :filetype | suboptions
4246
4319
function function name
4247
4320
help help subjects
4248
4321
highlight highlight groups
0 commit comments