vim-patch:9.0.1774: no support for custom cmdline completion (#24808)

Problem:  no support for custom cmdline completion
Solution: Add new vimscript functions

Add the following two functions:
- getcmdcompltype() returns custom and customlist functions

- getcompletion() supports both custom and customlist

closes: vim/vim#12228

92997dda78

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
zeertzjq
2023-08-21 07:29:49 +08:00
committed by GitHub
parent ac99e63d73
commit 694814cdd5
7 changed files with 87 additions and 6 deletions

View File

@@ -425,6 +425,13 @@ char *get_user_cmd_complete(expand_T *xp, int idx)
int cmdcomplete_str_to_type(const char *complete_str)
{
if (strncmp(complete_str, "custom,", 7) == 0) {
return EXPAND_USER_DEFINED;
}
if (strncmp(complete_str, "customlist,", 11) == 0) {
return EXPAND_USER_LIST;
}
for (int i = 0; i < (int)(ARRAY_SIZE(command_complete)); i++) {
char *cmd_compl = get_command_complete(i);
if (cmd_compl == NULL) {