diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-07-22 14:10:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 14:10:56 +0200 |
commit | ea35584bac6f33d4cb4fd59f5dcd0113e568c5a1 (patch) | |
tree | 96ad4635feac01e08b680cf7f70c224b980a5506 | |
parent | 6f48c018b526a776e38e94f58769c30141de9e0c (diff) | |
parent | 0bcf96bf0bf1136aa4fb09dd86461312a2bc4fbb (diff) | |
download | rneovim-ea35584bac6f33d4cb4fd59f5dcd0113e568c5a1.tar.gz rneovim-ea35584bac6f33d4cb4fd59f5dcd0113e568c5a1.tar.bz2 rneovim-ea35584bac6f33d4cb4fd59f5dcd0113e568c5a1.zip |
Merge pull request #14771 from gpanders/colorscheme
fix: source syncolors.vim before startup scripts
-rw-r--r-- | runtime/syntax/syncolor.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/synload.vim | 6 | ||||
-rw-r--r-- | src/nvim/main.c | 12 |
3 files changed, 14 insertions, 6 deletions
diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim index 5b907a3b83..27cc3360c4 100644 --- a/runtime/syntax/syncolor.vim +++ b/runtime/syntax/syncolor.vim @@ -25,6 +25,8 @@ else endif endif +let did_syncolor = 1 + " Many terminals can only use six different colors (plus black and white). " Therefore the number of colors used is kept low. It doesn't look nice with " too many colors anyway. diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim index 3863a84c1a..aee9ba8b8e 100644 --- a/runtime/syntax/synload.vim +++ b/runtime/syntax/synload.vim @@ -14,10 +14,8 @@ endif " let others know that syntax has been switched on let syntax_on = 1 -" Set the default highlighting colors. Use a color scheme if specified. -if exists("colors_name") - exe "colors " . colors_name -else +" Set the default highlighting colors +if !exists("colors_name") && !exists("did_syncolor") runtime! syntax/syncolor.vim endif diff --git a/src/nvim/main.c b/src/nvim/main.c index 909defe6d0..cf9cb9cfbd 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -366,11 +366,19 @@ int main(int argc, char **argv) // Execute --cmd arguments. exe_pre_commands(¶ms); + // If using the runtime (-u is not NONE), enable syntax & filetype plugins. + bool enable_syntax = + (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE")); + + // Source syncolor.vim to set up default UI highlights + if (enable_syntax) { + source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL); + } + // Source startup scripts. source_startup_scripts(¶ms); - // If using the runtime (-u is not NONE), enable syntax & filetype plugins. - if (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE")) { + if (enable_syntax) { // Does ":filetype plugin indent on". filetype_maybe_enable(); // Sources syntax/syntax.vim, which calls `:filetype on`. |