summaryrefslogtreecommitdiff
path: root/src/cmdexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-25 15:41:00 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-25 15:41:00 +0200
commit307c5a5bb77c3728dfab06c30e9f786309c63f74 (patch)
treef178edf16af0642f2a1236a41984db6f660727df /src/cmdexpand.c
parentc2b97643a82bb9fbd202312dac4aa995f92e9e5b (diff)
downloadvim-git-307c5a5bb77c3728dfab06c30e9f786309c63f74.tar.gz
patch 8.1.1927: code for dealing with script files is spread outv8.1.1927
Problem: Code for dealing with script files is spread out. Solution: Move the code to scriptfile.c. (Yegappan Lakshmanan, closes #4861)
Diffstat (limited to 'src/cmdexpand.c')
-rw-r--r--src/cmdexpand.c156
1 files changed, 0 insertions, 156 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 209013b08..b3f18c6de 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -19,8 +19,6 @@ static void set_expand_context(expand_T *xp);
static int ExpandFromContext(expand_T *xp, char_u *, int *, char_u ***, int);
static int expand_showtail(expand_T *xp);
static int expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int flagsarg);
-static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file, char *dirname[]);
-static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file);
#if defined(FEAT_EVAL)
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file);
static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file);
@@ -2565,160 +2563,6 @@ ExpandUserList(
# endif
/*
- * Expand color scheme, compiler or filetype names.
- * Search from 'runtimepath':
- * 'runtimepath'/{dirnames}/{pat}.vim
- * When "flags" has DIP_START: search also from 'start' of 'packpath':
- * 'packpath'/pack/ * /start/ * /{dirnames}/{pat}.vim
- * When "flags" has DIP_OPT: search also from 'opt' of 'packpath':
- * 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim
- * "dirnames" is an array with one or more directory names.
- */
- static int
-ExpandRTDir(
- char_u *pat,
- int flags,
- int *num_file,
- char_u ***file,
- char *dirnames[])
-{
- char_u *s;
- char_u *e;
- char_u *match;
- garray_T ga;
- int i;
- int pat_len;
-
- *num_file = 0;
- *file = NULL;
- pat_len = (int)STRLEN(pat);
- ga_init2(&ga, (int)sizeof(char *), 10);
-
- for (i = 0; dirnames[i] != NULL; ++i)
- {
- s = alloc(STRLEN(dirnames[i]) + pat_len + 7);
- if (s == NULL)
- {
- ga_clear_strings(&ga);
- return FAIL;
- }
- sprintf((char *)s, "%s/%s*.vim", dirnames[i], pat);
- globpath(p_rtp, s, &ga, 0);
- vim_free(s);
- }
-
- if (flags & DIP_START) {
- for (i = 0; dirnames[i] != NULL; ++i)
- {
- s = alloc(STRLEN(dirnames[i]) + pat_len + 22);
- if (s == NULL)
- {
- ga_clear_strings(&ga);
- return FAIL;
- }
- sprintf((char *)s, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat);
- globpath(p_pp, s, &ga, 0);
- vim_free(s);
- }
- }
-
- if (flags & DIP_OPT) {
- for (i = 0; dirnames[i] != NULL; ++i)
- {
- s = alloc(STRLEN(dirnames[i]) + pat_len + 20);
- if (s == NULL)
- {
- ga_clear_strings(&ga);
- return FAIL;
- }
- sprintf((char *)s, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat);
- globpath(p_pp, s, &ga, 0);
- vim_free(s);
- }
- }
-
- for (i = 0; i < ga.ga_len; ++i)
- {
- match = ((char_u **)ga.ga_data)[i];
- s = match;
- e = s + STRLEN(s);
- if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
- {
- e -= 4;
- for (s = e; s > match; MB_PTR_BACK(match, s))
- if (s < match || vim_ispathsep(*s))
- break;
- ++s;
- *e = NUL;
- mch_memmove(match, s, e - s + 1);
- }
- }
-
- if (ga.ga_len == 0)
- return FAIL;
-
- // Sort and remove duplicates which can happen when specifying multiple
- // directories in dirnames.
- remove_duplicates(&ga);
-
- *file = ga.ga_data;
- *num_file = ga.ga_len;
- return OK;
-}
-
-/*
- * Expand loadplugin names:
- * 'packpath'/pack/ * /opt/{pat}
- */
- static int
-ExpandPackAddDir(
- char_u *pat,
- int *num_file,
- char_u ***file)
-{
- char_u *s;
- char_u *e;
- char_u *match;
- garray_T ga;
- int i;
- int pat_len;
-
- *num_file = 0;
- *file = NULL;
- pat_len = (int)STRLEN(pat);
- ga_init2(&ga, (int)sizeof(char *), 10);
-
- s = alloc(pat_len + 26);
- if (s == NULL)
- {
- ga_clear_strings(&ga);
- return FAIL;
- }
- sprintf((char *)s, "pack/*/opt/%s*", pat);
- globpath(p_pp, s, &ga, 0);
- vim_free(s);
-
- for (i = 0; i < ga.ga_len; ++i)
- {
- match = ((char_u **)ga.ga_data)[i];
- s = gettail(match);
- e = s + STRLEN(s);
- mch_memmove(match, s, e - s + 1);
- }
-
- if (ga.ga_len == 0)
- return FAIL;
-
- // Sort and remove duplicates which can happen when specifying multiple
- // directories in dirnames.
- remove_duplicates(&ga);
-
- *file = ga.ga_data;
- *num_file = ga.ga_len;
- return OK;
-}
-
-/*
* Expand "file" for all comma-separated directories in "path".
* Adds the matches to "ga". Caller must init "ga".
*/