diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-04 19:18:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 19:18:16 -0400 |
commit | 4ad30f775e5564c539324b4818886f067d2ecd99 (patch) | |
tree | 97a554379bda7e5fc77e58c690db3f5a72db8c74 /runtime/syntax/ocaml.vim | |
parent | 63d8a8f4e8b02e524d85aed08aa16c5d9815598c (diff) | |
parent | d5b063aec1db95704b37a77fdbd968cb6b48cc3b (diff) | |
download | rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.gz rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.tar.bz2 rneovim-4ad30f775e5564c539324b4818886f067d2ecd99.zip |
Merge pull request #14424 from janlazo/vim-8.1.1726
vim-patch:8.1.1726,8.2.{296,860,1827,2388,2788,2790,2801}
Diffstat (limited to 'runtime/syntax/ocaml.vim')
-rw-r--r-- | runtime/syntax/ocaml.vim | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim index 42913f228e..af3efd3dab 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -4,7 +4,7 @@ " Maintainers: Markus Mottl <markus.mottl@gmail.com> " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> " Issac Trotts <ijtrotts@ucdavis.edu> -" URL: https://github.com/rgrinberg/vim-ocaml +" URL: https://github.com/ocaml/vim-ocaml " Last Change: " 2018 Nov 08 - Improved highlighting of operators (Maƫlan) " 2018 Apr 22 - Improved support for PPX (Andrey Popp) @@ -18,14 +18,20 @@ " can be distinguished from begin/end, which is used for indentation, " and folding. (David Baelde) -" quit when a syntax file was already loaded +" Quit when a syntax file was already loaded if exists("b:current_syntax") && b:current_syntax == "ocaml" finish endif +let s:keepcpo = &cpo +set cpo&vim + " ' can be used in OCaml identifiers setlocal iskeyword+=' +" ` is part of the name of polymorphic variants +setlocal iskeyword+=` + " OCaml is case sensitive. syn case match @@ -123,7 +129,7 @@ syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSi syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr " "open" -syn region ocamlNone matchgroup=ocamlKeyword start="\<open\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*\>" contains=@ocamlAllErrs,ocamlComment +syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod " "include" syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod @@ -225,7 +231,18 @@ syn match ocamlStar "*" syn match ocamlAngle "<" syn match ocamlAngle ">" " Custom indexing operators: -syn match ocamlIndexingOp "\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\(()\|\[]\|{}\)\(<-\)\?" +syn region ocamlIndexing matchgroup=ocamlIndexingOp + \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*(" + \ end=")\(\_s*<-\)\?" + \ contains=ALLBUT,@ocamlContained,ocamlParenErr +syn region ocamlIndexing matchgroup=ocamlIndexingOp + \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*\[" + \ end="]\(\_s*<-\)\?" + \ contains=ALLBUT,@ocamlContained,ocamlBrackErr +syn region ocamlIndexing matchgroup=ocamlIndexingOp + \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*{" + \ end="}\(\_s*<-\)\?" + \ contains=ALLBUT,@ocamlContained,ocamlBraceErr " Extension operators (has to be declared before regular infix operators): syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+" " Infix and prefix operators: @@ -283,7 +300,6 @@ syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>" syn sync match ocamlSigSync groupthere ocamlSig "\<end\>" " Define the default highlighting. -" Only when an item doesn't have highlighting yet hi def link ocamlBraceErr Error hi def link ocamlBrackErr Error @@ -308,14 +324,17 @@ hi def link ocamlModPath Include hi def link ocamlObject Include hi def link ocamlModule Include hi def link ocamlModParam1 Include +hi def link ocamlGenMod Include hi def link ocamlModType Include hi def link ocamlMPRestr3 Include hi def link ocamlFullMod Include +hi def link ocamlFuncWith Include +hi def link ocamlModParam Include hi def link ocamlModTypeRestr Include hi def link ocamlWith Include hi def link ocamlMTDef Include -hi def link ocamlSigEncl ocamlModule -hi def link ocamlStructEncl ocamlModule +hi def link ocamlSigEncl ocamlModule +hi def link ocamlStructEncl ocamlModule hi def link ocamlScript Include @@ -326,24 +345,25 @@ hi def link ocamlModPreRHS Keyword hi def link ocamlMPRestr2 Keyword hi def link ocamlKeyword Keyword hi def link ocamlMethod Include +hi def link ocamlArrow Keyword hi def link ocamlKeyChar Keyword hi def link ocamlAnyVar Keyword hi def link ocamlTopStop Keyword -hi def link ocamlRefAssign ocamlKeyChar -hi def link ocamlEqual ocamlKeyChar -hi def link ocamlStar ocamlInfixOp -hi def link ocamlAngle ocamlInfixOp -hi def link ocamlCons ocamlInfixOp +hi def link ocamlRefAssign ocamlKeyChar +hi def link ocamlEqual ocamlKeyChar +hi def link ocamlStar ocamlInfixOp +hi def link ocamlAngle ocamlInfixOp +hi def link ocamlCons ocamlInfixOp -hi def link ocamlPrefixOp ocamlOperator -hi def link ocamlInfixOp ocamlOperator -hi def link ocamlExtensionOp ocamlOperator -hi def link ocamlIndexingOp ocamlOperator +hi def link ocamlPrefixOp ocamlOperator +hi def link ocamlInfixOp ocamlOperator +hi def link ocamlExtensionOp ocamlOperator +hi def link ocamlIndexingOp ocamlOperator if exists("ocaml_highlight_operators") hi def link ocamlInfixOpKeyword ocamlOperator - hi def link ocamlOperator Operator + hi def link ocamlOperator Operator else hi def link ocamlInfixOpKeyword Keyword endif @@ -353,7 +373,7 @@ hi def link ocamlCharacter Character hi def link ocamlNumber Number hi def link ocamlFloat Float hi def link ocamlString String -hi def link ocamlQuotedStringDelim Identifier +hi def link ocamlQuotedStringDelim Identifier hi def link ocamlLabel Identifier @@ -363,8 +383,11 @@ hi def link ocamlTodo Todo hi def link ocamlEncl Keyword -hi def link ocamlPpxEncl ocamlEncl +hi def link ocamlPpxEncl ocamlEncl let b:current_syntax = "ocaml" +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: ts=8 |