vim-patch:3de7384: runtime(doc): Fix :help complete() example (#37891)

closes: vim/vim#18417

3de73844af

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
zeertzjq
2026-02-16 14:31:51 +08:00
committed by GitHub
parent 1eb2ca9fcf
commit b51fc202ce
3 changed files with 27 additions and 21 deletions

View File

@@ -1164,14 +1164,16 @@ complete({startcol}, {matches}) *complete()* *E78
Insert mode completion. The popup menu will appear if
specified, see |ins-completion-menu|.
Example: >vim
inoremap <F5> <C-R>=ListMonths()<CR>
func ListMonths()
call complete(col('.'), ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc
inoremap <F5> <C-R>=ListMonths()<CR>
func ListMonths()
call complete(col('.'), ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August',
\ 'September', 'October', 'November', 'December'])
return ''
endfunc
< This isn't very useful, but it shows how it works. Note that
an empty string is returned to avoid a zero being inserted.

View File

@@ -1017,14 +1017,16 @@ function vim.fn.col(expr, winid) end
--- Insert mode completion. The popup menu will appear if
--- specified, see |ins-completion-menu|.
--- Example: >vim
--- inoremap <F5> <C-R>=ListMonths()<CR>
---
--- func ListMonths()
--- call complete(col('.'), ['January', 'February', 'March',
--- \ 'April', 'May', 'June', 'July', 'August', 'September',
--- \ 'October', 'November', 'December'])
--- return ''
--- endfunc
--- inoremap <F5> <C-R>=ListMonths()<CR>
---
--- func ListMonths()
--- call complete(col('.'), ['January', 'February', 'March',
--- \ 'April', 'May', 'June', 'July', 'August',
--- \ 'September', 'October', 'November', 'December'])
--- return ''
--- endfunc
---
--- <This isn't very useful, but it shows how it works. Note that
--- an empty string is returned to avoid a zero being inserted.
---

View File

@@ -1363,14 +1363,16 @@ M.funcs = {
Insert mode completion. The popup menu will appear if
specified, see |ins-completion-menu|.
Example: >vim
inoremap <F5> <C-R>=ListMonths()<CR>
func ListMonths()
call complete(col('.'), ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc
inoremap <F5> <C-R>=ListMonths()<CR>
func ListMonths()
call complete(col('.'), ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August',
\ 'September', 'October', 'November', 'December'])
return ''
endfunc
<This isn't very useful, but it shows how it works. Note that
an empty string is returned to avoid a zero being inserted.