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"