EXP_SUBCMD, // expand ":syn" sub-commands
EXP_CASE, // expand ":syn case" arguments
EXP_SPELL, // expand ":syn spell" arguments
- EXP_SYNC // expand ":syn sync" arguments
+ EXP_SYNC, // expand ":syn sync" arguments
+ EXP_CLUSTER // expand ":syn list @cluster" arguments
} expand_what;
/*
expand_what = EXP_SPELL;
else if (STRNICMP(arg, "sync", p - arg) == 0)
expand_what = EXP_SYNC;
- else if ( STRNICMP(arg, "keyword", p - arg) == 0
+ else if (STRNICMP(arg, "list", p - arg) == 0)
+ {
+ p = skipwhite(p);
+ if (*p == '@')
+ expand_what = EXP_CLUSTER;
+ else
+ xp->xp_context = EXPAND_HIGHLIGHT;
+ }
+ else if (STRNICMP(arg, "keyword", p - arg) == 0
|| STRNICMP(arg, "region", p - arg) == 0
- || STRNICMP(arg, "match", p - arg) == 0
- || STRNICMP(arg, "list", p - arg) == 0)
+ || STRNICMP(arg, "match", p - arg) == 0)
xp->xp_context = EXPAND_HIGHLIGHT;
else
xp->xp_context = EXPAND_NOTHING;
char_u *
get_syntax_name(expand_T *xp UNUSED, int idx)
{
+#define CBUFFER_LEN 256
+ static char_u cbuffer[CBUFFER_LEN]; // TODO: better solution
+
switch (expand_what)
{
case EXP_SUBCMD:
"maxlines=", "minlines=", "region", NULL};
return (char_u *)sync_args[idx];
}
+ case EXP_CLUSTER:
+ {
+ if (idx < curwin->w_s->b_syn_clusters.ga_len)
+ {
+ vim_snprintf((char *)cbuffer, CBUFFER_LEN, "@%s",
+ SYN_CLSTR(curwin->w_s)[idx].scl_name);
+ return cbuffer;
+ }
+ else
+ return NULL;
+ }
}
return NULL;
}
call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_match('^"syn match Boolean Character ', @:)
+
+ syn cluster Aax contains=Aap
+ call feedkeys(":syn list @A\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_match('^"syn list @Aax', @:)
endfunc
func Test_echohl_completion()