mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
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:
@@ -4165,11 +4165,19 @@ static char *get_cmdline_completion(void)
|
||||
}
|
||||
|
||||
char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context);
|
||||
if (cmd_compl != NULL) {
|
||||
return xstrdup(cmd_compl);
|
||||
if (cmd_compl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (p->xpc->xp_context == EXPAND_USER_LIST
|
||||
|| p->xpc->xp_context == EXPAND_USER_DEFINED) {
|
||||
size_t buflen = strlen(cmd_compl) + strlen(p->xpc->xp_arg) + 2;
|
||||
char *buffer = xmalloc(buflen);
|
||||
snprintf(buffer, buflen, "%s,%s", cmd_compl, p->xpc->xp_arg);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
return xstrdup(cmd_compl);
|
||||
}
|
||||
|
||||
/// "getcmdcompltype()" function
|
||||
|
Reference in New Issue
Block a user