From 6ab4340abcb8c69cf4db087da0ccda533d21ede8 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 20 Aug 2026 16:25:57 -0400 Subject: [PATCH] Add Rust detection to propane.vim --- extra/vim/syntax/propane.vim | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/extra/vim/syntax/propane.vim b/extra/vim/syntax/propane.vim index a47cd5d..9350f3b 100644 --- a/extra/vim/syntax/propane.vim +++ b/extra/vim/syntax/propane.vim @@ -7,12 +7,28 @@ if exists("b:current_syntax") finish endif +" Guess the language of the user code blocks from their contents so that the +" matching syntax file can be included below. b:propane_subtype may also be set +" before this file is sourced to select the language explicitly. if !exists("b:propane_subtype") - if search('\ 0 + " Rust markers. Each keyword requires the syntax that follows it in Rust so + " that a plain identifier of the same name in another language does not match + " (`int fn = 3;' in C, for example). Type names are only accepted within a + " `ptype' statement for the same reason. + let s:rust = '\ 0 + let b:propane_subtype = "rust" + elseif search('\ 0 let b:propane_subtype = "d" else let b:propane_subtype = "cpp" endif + unlet s:rust endif exe "syn include @propaneTarget syntax/".b:propane_subtype.".vim"