diff src/cmdexpand.c @ 31790:18da1d44878a v9.0.1227

patch 9.0.1227: no cmdline completion for :runtime Commit: https://github.com/vim/vim/commit/a6759381a590b2d395e05b109ca9ccfc356be5a8 Author: root <root@acermirko.emind.lan> Date: Sat Jan 21 21:56:06 2023 +0000 patch 9.0.1227: no cmdline completion for :runtime Problem: No cmdline completion for :runtime. Solution: Add completion for :runtime. (closes https://github.com/vim/vim/issues/11853, closes https://github.com/vim/vim/issues/11447) Improve the resulting matches.
author Bram Moolenaar <Bram@vim.org>
date Sat, 21 Jan 2023 23:00:04 +0100
parents b89cfd86e18e
children 5948cc887603
line wrap: on
line diff
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -56,6 +56,7 @@ cmdline_fuzzy_completion_supported(expan
 	    && xp->xp_context != EXPAND_OLD_SETTING
 	    && xp->xp_context != EXPAND_OWNSYNTAX
 	    && xp->xp_context != EXPAND_PACKADD
+	    && xp->xp_context != EXPAND_RUNTIME
 	    && xp->xp_context != EXPAND_SHELLCMD
 	    && xp->xp_context != EXPAND_TAGS
 	    && xp->xp_context != EXPAND_TAGS_LISTFILES
@@ -1362,6 +1363,7 @@ addstar(
 	// For a tag pattern starting with "/" no translation is needed.
 	if (context == EXPAND_HELP
 		|| context == EXPAND_COLORS
+		|| context == EXPAND_RUNTIME
 		|| context == EXPAND_COMPILER
 		|| context == EXPAND_OWNSYNTAX
 		|| context == EXPAND_FILETYPE
@@ -2312,6 +2314,11 @@ set_context_by_cmdname(
 	    xp->xp_pattern = arg;
 	    break;
 
+	case CMD_runtime:
+	    xp->xp_context = EXPAND_RUNTIME;
+	    xp->xp_pattern = arg;
+	    break;
+
 	case CMD_compiler:
 	    xp->xp_context = EXPAND_COMPILER;
 	    xp->xp_pattern = arg;
@@ -3019,6 +3026,12 @@ ExpandFromContext(
 	return ExpandRTDir(pat, DIP_START + DIP_OPT, numMatches, matches,
 								directories);
     }
+    if (xp->xp_context == EXPAND_RUNTIME)
+    {
+	char *directories[] = {"", NULL};
+	return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_PRNEXT, numMatches,
+							 matches, directories);
+    }
     if (xp->xp_context == EXPAND_COMPILER)
     {
 	char *directories[] = {"compiler", NULL};