Merge pull request #14771 from gpanders/colorscheme

fix: source syncolors.vim before startup scripts
This commit is contained in:
Björn Linse 2021-07-22 14:10:56 +02:00 committed by GitHub
commit ea35584bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -366,11 +366,19 @@ int main(int argc, char **argv)
// Execute --cmd arguments.
exe_pre_commands(&params);
// 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(&params);
// 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`.