diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-27 17:00:33 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-27 17:00:33 +0000 |
| commit | ea5ab07dd68f702352b8c8f91ee4f7d64cad7c55 (patch) | |
| tree | 187b0f90ee864849e539d3b5045bf7d2b364494e | |
| download | alive.kak-ea5ab07dd68f702352b8c8f91ee4f7d64cad7c55.tar.gz alive.kak-ea5ab07dd68f702352b8c8f91ee4f7d64cad7c55.zip | |
initial commit
| -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-.+ + } +] |
