2017-02-26 23:54:06 +03:00
|
|
|
# http://ocaml.org
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global BufCreate .*\.mli? %{
|
2019-03-13 08:24:33 +03:00
|
|
|
set-option buffer filetype ocaml
|
2017-02-26 23:54:06 +03:00
|
|
|
}
|
|
|
|
|
2019-03-13 08:24:33 +03:00
|
|
|
hook -once global BufSetOption filetype=ocaml %{
|
|
|
|
require-module ocaml
|
|
|
|
}
|
|
|
|
|
|
|
|
provide-module ocaml %{
|
|
|
|
|
2017-02-26 23:54:06 +03:00
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-07-01 12:53:35 +03:00
|
|
|
add-highlighter shared/ocaml regions
|
|
|
|
add-highlighter shared/ocaml/code default-region group
|
2018-07-02 13:59:12 +03:00
|
|
|
add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" fill string
|
|
|
|
add-highlighter shared/ocaml/comment region \Q(* \Q*) fill comment
|
2017-02-26 23:54:06 +03:00
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-11-28 12:39:15 +03:00
|
|
|
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{
|
|
|
|
add-highlighter window/ocaml ref ocaml
|
2018-12-11 02:11:35 +03:00
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ocaml }
|
2018-11-28 12:39:15 +03:00
|
|
|
}
|
2017-02-26 23:54:06 +03:00
|
|
|
|
|
|
|
# Macro
|
|
|
|
# ‾‾‾‾‾
|
|
|
|
|
2018-05-07 00:29:52 +03:00
|
|
|
evaluate-commands %sh{
|
2017-02-26 23:54:06 +03:00
|
|
|
keywords=and:as:asr:assert:begin:class:constraint:do:done:downto:else:end:exception:external:false:for:fun:function:functor:if:in:include:inherit:initializer:land:lazy:let:lor:lsl:lsr:lxor:match:method:mod:module:mutable:new:nonrec:object:of:open:or:private:rec:sig:struct:then:to:true:try:type:val:virtual:when:while:with
|
|
|
|
echo "
|
2018-07-01 12:53:35 +03:00
|
|
|
add-highlighter shared/ocaml/code/ regex \b($(printf $keywords | tr : '|'))\b 0:keyword
|
2017-02-26 23:54:06 +03:00
|
|
|
hook global WinSetOption filetype=ocaml %{
|
2017-11-03 10:34:41 +03:00
|
|
|
set-option window static_words $keywords
|
2017-02-26 23:54:06 +03:00
|
|
|
}
|
|
|
|
"
|
|
|
|
}
|
2019-03-13 08:24:33 +03:00
|
|
|
|
|
|
|
}
|