From b0a1d1eb64e84eb9f25c48204ba4a36735cf1e75 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 14 Apr 2021 11:02:43 +0200 Subject: startup: do "syntax enable" instead of "syntax on" "syntax on" overwrites existing highlight groups, while "syntax enable" just sets missing groups. This change prevents user defined highlights in init.vim/lua to get overwritten. The manual recommends "syntax enable" for new configurations anyway, "on" command was probably used as it is the implicit default. --- src/nvim/main.c | 2 +- src/nvim/syntax.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/main.c b/src/nvim/main.c index 7064f2a068..56cd97f133 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -375,7 +375,7 @@ int main(int argc, char **argv) // Does ":filetype plugin indent on". filetype_maybe_enable(); // Sources syntax/syntax.vim, which calls `:filetype on`. - syn_maybe_on(); + syn_maybe_enable(); } // Read all the plugin files. diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 77a751e5ad..ed886ab7f9 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3469,13 +3469,13 @@ static void syn_cmd_onoff(exarg_T *eap, char *name) } } -void syn_maybe_on(void) +void syn_maybe_enable(void) { if (!did_syntax_onoff) { exarg_T ea; ea.arg = (char_u *)""; ea.skip = false; - syn_cmd_onoff(&ea, "syntax"); + syn_cmd_enable(&ea, false); } } -- cgit