git.s-ol.nu alive.kak / ea5ab07
initial commit s-ol 3 years ago
1 changed file(s) with 44 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 # Detection
1 hook global BufCreate .*[.](alv) %{
2 set-option buffer filetype alive
3 }
4
5 # Highlighters
6
7 add-highlighter shared/alive regions
8 add-highlighter shared/alive/code default-region group
9 add-highlighter shared/alive/dstring region '"' (?<!\\)(?:\\\\)*" fill string
10 add-highlighter shared/alive/qstring region "'" (?<!\\)(?:\\\\)*' fill string
11 add-highlighter shared/alive/comment region -recurse '\(' '#\(' '\)' fill comment
12 add-highlighter shared/alive/code/tag regex \[[0-9]+\] 0:rgb:696969
13
14 # Commands
15
16 # attempt to tame the autoreload, not 100% successful
17 define-command -hidden alive-reload-file %[
18 nop %sh{ sleep 0.01 }
19 edit!
20 ]
21
22 # Initialization
23
24 hook -group alive-highlight global WinSetOption filetype=alive %{
25 add-highlighter window/alive ref alive
26
27 hook -once -always window WinSetOption filetype=.* %{
28 remove-highlighter window/alive
29 }
30 }
31
32 hook global WinSetOption filetype=alive %[
33 set-option buffer comment_block_begin '#('
34 set-option buffer comment_block_end ')'
35 set-option buffer tabstop 2
36 set-option buffer indentwidth 2
37
38 hook -group alive-hooks window BufWritePost .* alive-reload-file
39
40 hook -once -always window WinSetOption filetype=.* %{
41 remove-hooks window alive-.+
42 }
43 ]