0
0
mirror of https://github.com/vim/vim.git synced 2025-10-06 05:44:14 -04:00

Add completion for ":ownsyntax" and improve completion for ":filetype".

(Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2010-07-29 20:59:59 +02:00
parent 8ada2cca0a
commit 1587a1e37d
6 changed files with 51 additions and 35 deletions

View File

@@ -9238,7 +9238,6 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
#if defined(FEAT_SEARCHPATH)
static int find_previous_pathsep __ARGS((char_u *path, char_u **psep));
static int is_unique __ARGS((char_u *maybe_unique, garray_T *gap, int i));
static void remove_duplicates __ARGS((garray_T *gap));
static void expand_path_option __ARGS((char_u *curdir, garray_T *gap));
static char_u *get_path_cutoff __ARGS((char_u *fname, garray_T *gap));
static void uniquefy_paths __ARGS((garray_T *gap, char_u *pattern));
@@ -9301,29 +9300,6 @@ is_unique(maybe_unique, gap, i)
return TRUE; /* no match found */
}
/*
* Remove adjacent duplicate entries from "gap", which is a list of file names
* in allocated memory.
*/
static void
remove_duplicates(gap)
garray_T *gap;
{
int i;
int j;
char_u **fnames = (char_u **)gap->ga_data;
for (i = 1; i < gap->ga_len; ++i)
if (fnamecmp(fnames[i - 1], fnames[i]) == 0)
{
vim_free(fnames[i]);
for (j = i + 1; j < gap->ga_len; ++j)
fnames[j - 1] = fnames[j];
--gap->ga_len;
--i;
}
}
/*
* Split the 'path' option to a an array of strings as garray_T. Relative
* paths are expanded to their equivalent fullpath. This includes the "."
@@ -9642,6 +9618,30 @@ expand_in_path(gap, pattern, flags)
}
#endif
#if defined(FEAT_SEARCHPATH) || defined(FEAT_CMDL_COMPL) || defined(PROTO)
/*
* Remove adjacent duplicate entries from "gap", which is a list of file names
* in allocated memory.
*/
void
remove_duplicates(gap)
garray_T *gap;
{
int i;
int j;
char_u **fnames = (char_u **)gap->ga_data;
for (i = gap->ga_len - 1; i > 0; --i)
if (fnamecmp(fnames[i - 1], fnames[i]) == 0)
{
vim_free(fnames[i]);
for (j = i + 1; j < gap->ga_len; ++j)
fnames[j - 1] = fnames[j];
--gap->ga_len;
}
}
#endif
/*
* Generic wildcard expansion code.
*