From bc876fa4b6e493df705c07d852bfc13db9ba7f80 Mon Sep 17 00:00:00 2001 From: Daniel Lewan Date: Thu, 1 Feb 2018 00:33:44 +0100 Subject: [PATCH 2/2] add justfiles support --- rc/extra/just.kak | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 rc/extra/just.kak diff --git a/rc/extra/just.kak b/rc/extra/just.kak new file mode 100644 index 00000000..3fc18d08 --- /dev/null +++ b/rc/extra/just.kak @@ -0,0 +1,55 @@ +# Detection +# ‾‾‾‾‾‾‾‾‾ + +hook global BufCreate .*/?[jJ]ustfile %{ + set-option buffer filetype justfile +} + +# Indentation +# ‾‾‾‾‾‾‾‾‾‾‾ + +define-command -hidden just-indent-on-new-line %{ + evaluate-commands -draft -itersel %{ + # preserve previous line indent + try %{ execute-keys -draft \;K } + # cleanup trailing white spaces on previous line + try %{ execute-keys -draft k s \h+$ "_d } + # copy '#' comment prefix and following white spaces + try %{ execute-keys -draft k s ^\h*//\h* y jgh P } + } +} + +# Highlighters +# ‾‾‾‾‾‾‾‾‾‾‾‾ + +add-highlighter shared/ regions -default content justfile \ + comment '#' '$' '' \ + double_string '"' (?