summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-11-02 18:21:59 +1100
committerMaxime Coste <mawww@kakoune.org>2023-11-02 18:21:59 +1100
commite882c235010aabfb933bc7fd555572aa435983a2 (patch)
tree5782cc53e71d3ae76eeb0068718bcbb38eef9297
parent81d94ac06c39914778ada4a336e3411978007877 (diff)
parent4332b0dc7152f4682cd4771f4798fd93792a1ae9 (diff)
Merge remote-tracking branch 'greenfork/improve-janet-syntax'
-rw-r--r--rc/filetype/janet.kak13
1 files changed, 8 insertions, 5 deletions
diff --git a/rc/filetype/janet.kak b/rc/filetype/janet.kak
index b5f7c7b5..00f39c27 100644
--- a/rc/filetype/janet.kak
+++ b/rc/filetype/janet.kak
@@ -35,14 +35,15 @@ add-highlighter shared/janet regions
add-highlighter shared/janet/code default-region group
add-highlighter shared/janet/comment region '(?<!\\)(?:\\\\)*\K#' '$' fill comment
add-highlighter shared/janet/comment-form region -recurse \( '(?<!\\)(?:\\\\)*\K\(comment ' '\)' fill comment
-add-highlighter shared/janet/string region '(^\s+```)|(?<!\\)(?:\\\\)*\K"' '(^\s+```)|(?<!\\)(?:\\\\)*"' fill string
+add-highlighter shared/janet/string region '(?<!\\)(?:\\\\)*\K"' '(?<!\\)(?:\\\\)*"' fill string
+add-highlighter shared/janet/raw-string region -match-capture '(`+)' '(`+)' fill string
add-highlighter shared/janet/code/ regex \b(nil|true|false)\b 0:value
-add-highlighter shared/janet/code/keyword regex \W\K:[!@$%\^&*\-_+=:<>.?\w]+ 0:value
add-highlighter shared/janet/code/number regex \W\K(?:[\-+]?\dx?[\der._+a-f]*)\b 0:value
-add-highlighter shared/janet/code/function-definition regex \((?:defn|fn)\s([!@$%\^&*\-_+=:<>.?\w]+) 1:function
+add-highlighter shared/janet/code/function-definition regex \((?:defn-?|fn)\s([!@$%\^&*\-_+=:<>.?\w/]+) 1:function
add-highlighter shared/janet/code/function-call regex \(([!@$%\^&*\-_+=:<>.?\w/]+) 1:function
-add-highlighter shared/janet/code/special regex \((def|defn|var|fn|do|quote|if|splice|while|break|set|quasiquote|unquote|upscope)\b\s 1:keyword
-add-highlighter shared/janet/code/ regex \W\K(&|&opt)\W 1:keyword
+add-highlighter shared/janet/code/keyword regex \W\K:[!@$%\^&*\-_+=:<>.?\w/]+ 0:value
+add-highlighter shared/janet/code/special regex \((def-?|defn-?|var-?|fn|do|quote|if|splice|while|break|set|quasiquote|unquote|upscope)\s 1:keyword
+add-highlighter shared/janet/code/ regex \W\K(&|&opt|&keys|&named)\W 1:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@@ -72,6 +73,8 @@ define-command -hidden janet-indent-on-new-line %{
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft '"i<a-z>a&,'
+ # trim trailing whitespace on the previous line
+ try %{ execute-keys -draft k : janet-trim-indent <ret> }
}
}