mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.0.0157: no completion for :syntax spell and :syntax sync
Problem: No command line completion for ":syntax spell" and ":syntax sync". Solution: Implement the completion. (Dominique Pelle)
This commit is contained in:
38
src/syntax.c
38
src/syntax.c
@@ -6383,7 +6383,9 @@ syntax_present(win_T *win)
|
|||||||
static enum
|
static enum
|
||||||
{
|
{
|
||||||
EXP_SUBCMD, /* expand ":syn" sub-commands */
|
EXP_SUBCMD, /* expand ":syn" sub-commands */
|
||||||
EXP_CASE /* expand ":syn case" arguments */
|
EXP_CASE, /* expand ":syn case" arguments */
|
||||||
|
EXP_SPELL, /* expand ":syn spell" arguments */
|
||||||
|
EXP_SYNC /* expand ":syn sync" arguments */
|
||||||
} expand_what;
|
} expand_what;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6434,6 +6436,10 @@ set_context_in_syntax_cmd(expand_T *xp, char_u *arg)
|
|||||||
xp->xp_context = EXPAND_NOTHING;
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
else if (STRNICMP(arg, "case", p - arg) == 0)
|
else if (STRNICMP(arg, "case", p - arg) == 0)
|
||||||
expand_what = EXP_CASE;
|
expand_what = EXP_CASE;
|
||||||
|
else if (STRNICMP(arg, "spell", p - arg) == 0)
|
||||||
|
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, "keyword", p - arg) == 0
|
||||||
|| STRNICMP(arg, "region", p - arg) == 0
|
|| STRNICMP(arg, "region", p - arg) == 0
|
||||||
|| STRNICMP(arg, "match", p - arg) == 0
|
|| STRNICMP(arg, "match", p - arg) == 0
|
||||||
@@ -6445,8 +6451,6 @@ set_context_in_syntax_cmd(expand_T *xp, char_u *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *(case_args[]) = {"match", "ignore", NULL};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function given to ExpandGeneric() to obtain the list syntax names for
|
* Function given to ExpandGeneric() to obtain the list syntax names for
|
||||||
* expansion.
|
* expansion.
|
||||||
@@ -6454,9 +6458,31 @@ static char *(case_args[]) = {"match", "ignore", NULL};
|
|||||||
char_u *
|
char_u *
|
||||||
get_syntax_name(expand_T *xp UNUSED, int idx)
|
get_syntax_name(expand_T *xp UNUSED, int idx)
|
||||||
{
|
{
|
||||||
if (expand_what == EXP_SUBCMD)
|
switch (expand_what)
|
||||||
return (char_u *)subcommands[idx].name;
|
{
|
||||||
return (char_u *)case_args[idx];
|
case EXP_SUBCMD:
|
||||||
|
return (char_u *)subcommands[idx].name;
|
||||||
|
case EXP_CASE:
|
||||||
|
{
|
||||||
|
static char *case_args[] = {"match", "ignore", NULL};
|
||||||
|
return (char_u *)case_args[idx];
|
||||||
|
}
|
||||||
|
case EXP_SPELL:
|
||||||
|
{
|
||||||
|
static char *spell_args[] =
|
||||||
|
{"toplevel", "notoplevel", "default", NULL};
|
||||||
|
return (char_u *)spell_args[idx];
|
||||||
|
}
|
||||||
|
case EXP_SYNC:
|
||||||
|
{
|
||||||
|
static char *sync_args[] =
|
||||||
|
{"ccomment", "clear", "fromstart",
|
||||||
|
"linebreaks=", "linecont", "lines=", "match",
|
||||||
|
"maxlines=", "minlines=", "region", NULL};
|
||||||
|
return (char_u *)sync_args[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_CMDL_COMPL */
|
#endif /* FEAT_CMDL_COMPL */
|
||||||
|
@@ -150,6 +150,12 @@ func Test_syntax_completion()
|
|||||||
call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn case \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_equal('"syn case ignore match', @:)
|
call assert_equal('"syn case ignore match', @:)
|
||||||
|
|
||||||
|
call feedkeys(":syn spell \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"syn spell default notoplevel toplevel', @:)
|
||||||
|
|
||||||
|
call feedkeys(":syn sync \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:)
|
||||||
|
|
||||||
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_match('^"syn list Boolean Character ', @:)
|
call assert_match('^"syn list Boolean Character ', @:)
|
||||||
|
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
157,
|
||||||
/**/
|
/**/
|
||||||
156,
|
156,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user