# Detection # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*/?[jJ]ustfile %{ set-option buffer filetype justfile } hook global WinSetOption filetype=justfile %{ require-module justfile hook window InsertChar \n -group justfile-indent just-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window justfile-.+ } } hook -group justfile-highlight global WinSetOption filetype=justfile %{ add-highlighter window/justfile ref justfile hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/justfile } } provide-module 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/justfile regions add-highlighter shared/justfile/content default-region group add-highlighter shared/justfile/comment region '#' '$' fill comment add-highlighter shared/justfile/double_string region '"' (?