diff options
-rw-r--r-- | src/nvim/globals.h | 4 | ||||
-rw-r--r-- | src/nvim/main.c | 2 | ||||
-rw-r--r-- | src/nvim/syntax.c | 16 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 76ed09cc3a..697a4a765a 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -92,10 +92,6 @@ # define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim" #endif -#ifndef SYNTAX_FILE -# define SYNTAX_FILE "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "syntax.vim" -#endif - #ifndef EXRC_FILE # define EXRC_FILE ".exrc" #endif diff --git a/src/nvim/main.c b/src/nvim/main.c index 97cccb2e25..b1f5a6ccad 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -337,7 +337,7 @@ int main(int argc, char **argv) // Do this before syntax/syntax.vim (which calls `:filetype on`). force_enable_filetype(); // Enable syntax highlighting. - do_source((char_u *)SYNTAX_FILE, false, DOSO_NONE); + syn_cmd("syntax"); // sources syntax/syntax.vim } /* diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index baf5d4784d..ce19320331 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3286,17 +3286,23 @@ static void syn_cmd_off(exarg_T *eap, int syncing) } static void syn_cmd_onoff(exarg_T *eap, char *name) + FUNC_ATTR_NONNULL_ALL { - char buf[100]; - eap->nextcmd = check_nextcmd(eap->arg); if (!eap->skip) { - strcpy(buf, "so "); - vim_snprintf(buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); - do_cmdline_cmd(buf); + syn_cmd(name); } } +void syn_cmd(char *name) + FUNC_ATTR_NONNULL_ALL +{ + char buf[100]; + strncpy(buf, "so ", 3); + vim_snprintf(buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); + do_cmdline_cmd(buf); +} + /* * Handle ":syntax [list]" command: list current syntax words. */ |