vim-patch:9.1.1505: not possible to return completion type for :ex command

Problem:  not possible to return command-line completion type for :ex
          command
Solution: make getcmdcompltype() accept an optional and return the
          command-line completion for that arg (Shougo Matsushita).

closes: vim/vim#17606

5d2354fc07

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
zeertzjq
2025-07-06 08:29:46 +08:00
parent 8fe4e120a2
commit 6ebcb4a4d6
6 changed files with 67 additions and 32 deletions

View File

@@ -3751,19 +3751,22 @@ M.funcs = {
signature = 'getcmdcomplpat()',
},
getcmdcompltype = {
args = { 0, 1 },
base = 1,
desc = [=[
Return the type of the current command-line completion.
Only works when the command line is being edited, thus
requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
Return the type of command-line completion using {pat}.
If {pat} is omited, only works when the command line is being
edited, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
See |:command-completion| for the return string.
Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
|getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|.
Returns an empty string when completion is not defined.
]=],
name = 'getcmdcompltype',
params = {},
params = { { 'pat', 'string' } },
returns = 'string',
signature = 'getcmdcompltype()',
signature = 'getcmdcompltype([{pat}])',
},
getcmdline = {
desc = [=[