commit fbcdbd458f27e427800c8105ebc8697563fba1b0
parent 1571fde23ecd8ce6a42f3dfef69bb066223fd714
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 13 Nov 2025 07:45:50 +0800
vim-patch:e9d296e: runtime(erlang): recognize -if/-elif as erlangPreCondit in syntax script (#36542)
The -if(Condition)/-elif(Condition) are compiler macros that evaluate
the following lines only if Condition evaluates to true. This patch
enables syntax highlighting for these macros.
https://www.erlang.org/doc/system/macros.html#conditional-compilation
closes: vim/vim#18729
https://github.com/vim/vim/commit/e9d296e52a6d0cb13d71b36ca60bfb470ce56868
Co-authored-by: Vadim Yanitskiy <fixeria@osmocom.org>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim
@@ -3,7 +3,7 @@
" Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
" Contributor: Adam Rutkowski <hq@mtod.org>
" Johannes Christ <jc@jchri.st>
-" Last Update: 2025-Jul-06
+" Last Update: 2025-Nov-12
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime
@@ -217,7 +217,7 @@ syn match erlangInnerDocAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(moduledoc\|doc\)\>
syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment
syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment
syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment
-syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|endif\)\>' contains=erlangComment
+syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|if\|elif\|endif\)\>' contains=erlangComment
syn match erlangType '^\s*-\%(\s\|\n\|%.*\n\)*\%(spec\|type\|opaque\|nominal\|callback\)\>' contains=erlangComment
" Keywords