From 32648d6cf48a4368b857a27b6fc2f626958ee552 Mon Sep 17 00:00:00 2001 From: Leonardo Dias ~Lordie Date: Tue, 1 Oct 2019 23:44:54 -0300 Subject: [PATCH 1/3] Better elm syntax lighting this will only highlight elm 0.19 (latest) properly very close to how https://ellie-app.com/ highlights - anything that starts with an upper case letter is a type - anything that starts with a lower case letter is a function - function declaration is just a function at the start of a line note: the default color scheme looks too colorful --- rc/filetype/elm.kak | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index 88057428..b8171127 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -30,16 +30,21 @@ provide-module elm %[ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/elm regions -add-highlighter shared/elm/code default-region group -add-highlighter shared/elm/string region '"' (?|->)\B 0:operator +add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta +add-highlighter shared/elm/code/ regex (\b(type|alias|if|then|else|case|of|let|in|infix|->)\b)|(\B(:)\B) 0:keyword + -add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta -add-highlighter shared/elm/code/ regex \b(True|False)\b 0:value -add-highlighter shared/elm/code/ regex \b(if|then|else|case|of|let|in|type|port|alias)\b 0:keyword -add-highlighter shared/elm/code/ regex \b(Array|Bool|Char|Float|Int|String)\b 0:type # Commands # ‾‾‾‾‾‾‾‾ From 220d5b6e727242b9650180fdf5fa3ac1d016c298 Mon Sep 17 00:00:00 2001 From: Leonardo Dias ~Lordie Date: Wed, 2 Oct 2019 03:46:23 -0300 Subject: [PATCH 2/3] fixed regex for matching words the regex for matching words was matching some characters that elm does not parse added <_> and <->> as keywords --- rc/filetype/elm.kak | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index b8171127..0365c6e7 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -36,15 +36,13 @@ add-highlighter shared/elm/string region '"' (?|->)\B 0:operator -add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta -add-highlighter shared/elm/code/ regex (\b(type|alias|if|then|else|case|of|let|in|infix|->)\b)|(\B(:)\B) 0:keyword - - +add-highlighter shared/elm/code/ regex \b([A-Z]+[^\s]*)\b 0:type +add-highlighter shared/elm/code/ regex \b([a-z]+[^\s]*)\b 0:variable +add-highlighter shared/elm/code/ regex \b(^[a-z]+[^\s]*)\b 0:function +add-highlighter shared/elm/code/ regex "-?\b[0-9]*\.?[0-9]+" 0:value +add-highlighter shared/elm/code/ regex \B(\+|\+\+|\*|/|//|-|=|==|&&|\|\||<\||\|>)\B 0:operator +add-highlighter shared/elm/code/ regex \b(import|exposing|as|module|where)\b 0:meta +add-highlighter shared/elm/code/ regex (\b(type|alias|if|then|else|case|of|let|in|infix|_)\b)|(\B(->|:)\B) 0:keyword # Commands # ‾‾‾‾‾‾‾‾