diff options
| -rw-r--r-- | alive.kak | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/alive.kak b/alive.kak new file mode 100644 index 0000000..e811e88 --- /dev/null +++ b/alive.kak @@ -0,0 +1,44 @@ +# Detection +hook global BufCreate .*[.](alv) %{ + set-option buffer filetype alive +} + +# Highlighters + +add-highlighter shared/alive regions +add-highlighter shared/alive/code default-region group +add-highlighter shared/alive/dstring region '"' (?<!\\)(?:\\\\)*" fill string +add-highlighter shared/alive/qstring region "'" (?<!\\)(?:\\\\)*' fill string +add-highlighter shared/alive/comment region -recurse '\(' '#\(' '\)' fill comment +add-highlighter shared/alive/code/tag regex \[[0-9]+\] 0:rgb:696969 + +# Commands + +# attempt to tame the autoreload, not 100% successful +define-command -hidden alive-reload-file %[ + nop %sh{ sleep 0.01 } + edit! +] + +# Initialization + +hook -group alive-highlight global WinSetOption filetype=alive %{ + add-highlighter window/alive ref alive + + hook -once -always window WinSetOption filetype=.* %{ + remove-highlighter window/alive + } +} + +hook global WinSetOption filetype=alive %[ + set-option buffer comment_block_begin '#(' + set-option buffer comment_block_end ')' + set-option buffer tabstop 2 + set-option buffer indentwidth 2 + + hook -group alive-hooks window BufWritePost .* alive-reload-file + + hook -once -always window WinSetOption filetype=.* %{ + remove-hooks window alive-.+ + } +] |
