From d3538e16a1f1086536c77fe032107939095a0b1a Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Sun, 2 Feb 2025 18:52:11 -0500 Subject: [PATCH] Ensure required Vim syntaxes are enabled https://github.com/vim/vim/commit/61fd27032e2bba6ecea1d1baadf1d8dbbe88b649#diff-a43cea7603144b91369f5717ea0d128a0dd09242dfb2eec713ecc12eaa8d15cc Co-authored-by: laniakea64 --- syntax/just.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/syntax/just.vim b/syntax/just.vim index f051259..8c7eae4 100644 --- a/syntax/just.vim +++ b/syntax/just.vim @@ -10,6 +10,12 @@ endif let b:current_syntax = 'just' +" Ensure the Vim syntaxes required by this file are enabled. +" Setting and restoring 'cpoptions' is documented not to have side effects, +" so this does not need to be conditionally gated. +let s:cpo_save = &cpo +set cpo&vim + " syncing fromstart prevents mismatched highlighting when jumping around in a justfile " linebreaks= keeps multi-line constructs highlighted correctly while typing syn sync fromstart linebreaks=10 @@ -320,6 +326,10 @@ syn match justModStatement '^mod' contained syn match justOptionalFile '\V?' contained + +let &cpo = s:cpo_save +unlet s:cpo_save + " Most linked colorscheme colors are chosen based on semantics of the color name. " Some are for parity with other syntax files (for example, Number for recipe body highlighting " is to align with the make.vim distributed with Vim). @@ -330,7 +340,8 @@ syn match justOptionalFile '\V?' contained " " Note that vim-just's highlight groups are an implementation detail and may be subject to change. -" The list of highlight links is sorted alphabetically. +" The list of highlight links is sorted alphabetically, +" and is placed at the very end of the file to simplify keeping it sorted. hi def link justAlias Statement hi def link justAssignmentOperator Operator