From 904cec3c4a329cf89fc3219d359239910d61f3f6 Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 28 Jan 2025 09:14:32 +0000 Subject: init commit --- autoload/filetype/sml.kak | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 autoload/filetype/sml.kak (limited to 'autoload/filetype/sml.kak') diff --git a/autoload/filetype/sml.kak b/autoload/filetype/sml.kak new file mode 100644 index 0000000..961d58d --- /dev/null +++ b/autoload/filetype/sml.kak @@ -0,0 +1,86 @@ +# https://smlfamily.github.io +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +# Detection +# ‾‾‾‾‾‾‾‾‾ + +hook global BufCreate .*\.(sml|fun|sig) %{ + set-option buffer filetype sml +} + +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=sml %{ + require-module sml + set-option buffer extra_word_chars '_' "'" + set-option window static_words %opt{sml_static_words} +} + +hook -group sml-highlight global WinSetOption filetype=sml %{ + add-highlighter window/sml ref sml + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sml } +} + +provide-module sml %[ + +# Highlighters +# ‾‾‾‾‾‾‾‾‾‾‾‾ + +add-highlighter shared/sml regions +add-highlighter shared/sml/code default-region group +add-highlighter shared/sml/string region '#?"' '(?%%&$?`\\#:|]+" 0:operator + +# Record projection functions +add-highlighter shared/sml/code/ regex "(?%%&$?`\\#:|])#([\w']+)?(?![!*/+\-~\^@=<>%%&$?`\\#:|])" 0:function + +# Symbolic keywords +add-highlighter shared/sml/code/ regex "(?%%&$?`\\#:|])(=>|=|\*|->|:>|:|;|\.\.\.|\b_\b|\|)(?![!*/+\-~\^@=<>%%&$?`\\#:|])" 0:keyword + +# Type variables +add-highlighter shared/sml/code/ regex "(?