diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-10-08 09:35:23 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-10-08 09:35:23 +0800 |
commit | 76606b6bc587fddcf990cf40a39521750734a80d (patch) | |
tree | 2810779733954dccec0bae739768b8d4e4186d4c /src/nvim/syntax.c | |
parent | f2b9ccec106b6c4619cc762ea77546810f1cbfd4 (diff) | |
parent | 032b088c848585e60e8dc1a210f240bad6bb3387 (diff) | |
download | rneovim-76606b6bc587fddcf990cf40a39521750734a80d.tar.gz rneovim-76606b6bc587fddcf990cf40a39521750734a80d.tar.bz2 rneovim-76606b6bc587fddcf990cf40a39521750734a80d.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 65c0e2464a..8de81f02df 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5567,8 +5567,10 @@ bool syntax_present(win_T *win) static enum { - EXP_SUBCMD, /* expand ":syn" sub-commands */ - EXP_CASE /* expand ":syn case" arguments */ + EXP_SUBCMD, // expand ":syn" sub-commands + EXP_CASE, // expand ":syn case" arguments + EXP_SPELL, // expand ":syn spell" arguments + EXP_SYNC // expand ":syn sync" arguments } expand_what; /* @@ -5612,6 +5614,10 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg) xp->xp_context = EXPAND_NOTHING; } else if (STRNICMP(arg, "case", p - arg) == 0) { 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 || STRNICMP(arg, "region", p - arg) == 0 || STRNICMP(arg, "match", p - arg) == 0 @@ -5624,17 +5630,33 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg) } } -static char *(case_args[]) = {"match", "ignore", NULL}; - /* * Function given to ExpandGeneric() to obtain the list syntax names for * expansion. */ char_u *get_syntax_name(expand_T *xp, int idx) { - if (expand_what == EXP_SUBCMD) - return (char_u *)subcommands[idx].name; - return (char_u *)case_args[idx]; + switch (expand_what) { + 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; } @@ -6825,8 +6847,6 @@ int hl_combine_attr(int char_attr, int prim_attr) if (char_aep != NULL) { // Copy all attributes from char_aep to the new entry new_en = *char_aep; - } else { - memset(&new_en, 0, sizeof(new_en)); } spell_aep = syn_cterm_attr2entry(prim_attr); |