From 6512eafa6006976bd65336ab94d6f1ebd54022e4 Mon Sep 17 00:00:00 2001 From: Justin Frank Date: Thu, 11 Apr 2019 15:54:58 -0700 Subject: [PATCH] Update remaining files to new provide/require format --- rc/filetype/cabal.kak | 36 +++++++------ rc/filetype/cmake.kak | 12 ++--- rc/filetype/coffee.kak | 31 ++++++------ rc/filetype/cucumber.kak | 31 ++++++------ rc/filetype/elm.kak | 30 +++++------ rc/filetype/exherbo.kak | 87 ++++++++++++++++---------------- rc/filetype/gas.kak | 21 ++++---- rc/filetype/haml.kak | 31 ++++++------ rc/filetype/hbs.kak | 33 ++++++------ rc/filetype/i3.kak | 37 +++++++------- rc/filetype/ini.kak | 13 ++--- rc/filetype/java.kak | 37 +++++++------- rc/filetype/julia.kak | 19 +++---- rc/filetype/just.kak | 21 ++++---- rc/filetype/kickstart.kak | 14 ++--- rc/filetype/markdown.kak | 27 +++++----- rc/filetype/mercurial.kak | 14 ++--- rc/filetype/moon.kak | 43 ++++++++-------- rc/filetype/restructuredtext.kak | 18 +++---- rc/filetype/taskpaper.kak | 27 +++++----- rc/filetype/toml.kak | 31 ++++++------ rc/filetype/yaml.kak | 29 +++++------ 22 files changed, 314 insertions(+), 328 deletions(-) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index daff0bff..a376a2f7 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -8,10 +8,26 @@ hook global BufCreate .*[.](cabal) %{ set-option buffer filetype cabal } -hook -once global BufSetOption filetype=cabal %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=cabal %[ require-module cabal + + hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent + hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line + hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace + hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cabal-.+ } +] + +hook -group cabal-highlight global WinSetOption filetype=cabal %{ + add-highlighter window/cabal ref cabal + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cabal } } + provide-module cabal %[ # Highlighters @@ -61,22 +77,4 @@ define-command -hidden cabal-indent-on-closing-curly-brace %[ ] ] -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group cabal-highlight global WinSetOption filetype=cabal %{ - add-highlighter window/cabal ref cabal - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cabal } - -} - -hook global WinSetOption filetype=cabal %[ - hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent - hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line - hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace - hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cabal-.+ } -] - ] diff --git a/rc/filetype/cmake.kak b/rc/filetype/cmake.kak index c0c3bb2c..cb5c65db 100644 --- a/rc/filetype/cmake.kak +++ b/rc/filetype/cmake.kak @@ -6,10 +6,15 @@ hook global BufCreate .*/CMakeCache.txt %{ set-option buffer filetype ini } -hook -once global BufSetOption filetype=cmake %{ +hook global WinSetOption filetype=cmake %{ require-module cmake } +hook -group cmake-highlight global WinSetOption filetype=cmake %{ + add-highlighter window/cmake ref cmake + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake } +} + provide-module cmake %{ add-highlighter shared/cmake regions @@ -27,9 +32,4 @@ add-highlighter shared/cmake/argument/quoted/ fill string add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function -hook -group cmake-highlight global WinSetOption filetype=cmake %{ - add-highlighter window/cmake ref cmake - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake } -} - } diff --git a/rc/filetype/coffee.kak b/rc/filetype/coffee.kak index f0b5ac58..a4b2fab6 100644 --- a/rc/filetype/coffee.kak +++ b/rc/filetype/coffee.kak @@ -8,10 +8,24 @@ hook global BufCreate .*[.](coffee) %{ set-option buffer filetype coffee } -hook -once global BufSetOption filetype=coffee %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=coffee %{ require-module coffee + + hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent + hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ } } +hook -group coffee-highlight global WinSetOption filetype=coffee %{ + add-highlighter window/coffee ref coffee + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/coffee } +} + + provide-module coffee %[ # Highlighters @@ -69,19 +83,4 @@ define-command -hidden coffee-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group coffee-highlight global WinSetOption filetype=coffee %{ - add-highlighter window/coffee ref coffee - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/coffee } -} - -hook global WinSetOption filetype=coffee %{ - hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent - hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ } -} - ] diff --git a/rc/filetype/cucumber.kak b/rc/filetype/cucumber.kak index 55fe892a..aa24423c 100644 --- a/rc/filetype/cucumber.kak +++ b/rc/filetype/cucumber.kak @@ -8,10 +8,24 @@ hook global BufCreate .*[.](feature|story) %{ set-option buffer filetype cucumber } -hook -once global BufSetOption filetype=cucumber %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=cucumber %{ require-module cucumber + + hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent + hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ } } +hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ + add-highlighter window/cucumber ref cucumber + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cucumber } +} + + provide-module cucumber %{ # Highlighters @@ -79,19 +93,4 @@ define-command -hidden cucumber-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ - add-highlighter window/cucumber ref cucumber - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cucumber } -} - -hook global WinSetOption filetype=cucumber %{ - hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent - hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ } -} - } diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index 8b97ff22..88057428 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -8,8 +8,21 @@ hook global BufCreate .*[.](elm) %{ set-option buffer filetype elm } -hook -once global BufSetOption filetype=elm %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=elm %{ require-module elm + + hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent + hook window InsertChar \n -group elm-indent elm-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ } +} + +hook -group elm-highlight global WinSetOption filetype=elm %{ + add-highlighter window/elm ref elm + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elm } } provide-module elm %[ @@ -57,19 +70,4 @@ define-command -hidden elm-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group elm-highlight global WinSetOption filetype=elm %{ - add-highlighter window/elm ref elm - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elm } -} - -hook global WinSetOption filetype=elm %{ - hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent - hook window InsertChar \n -group elm-indent elm-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ } -} - ] diff --git a/rc/filetype/exherbo.kak b/rc/filetype/exherbo.kak index b0f73929..72714255 100644 --- a/rc/filetype/exherbo.kak +++ b/rc/filetype/exherbo.kak @@ -25,16 +25,23 @@ hook global BufCreate .*/etc/paludis(-.*)?/repository_defaults\.conf hook global BufCreate .*/etc/paludis(-.*)?/specpath\.conf %{ set-option buffer filetype paludis-key-value-conf } hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf } -hook -once global BufSetOption filetype=exheres-0-(licence-groups|metadata) %{ +hook global WinSetOption filetype=exheres-0-(metadata|options-descriptions|licence-groups) %{ require-module exheres } -hook -once global BufSetOption filetype=paludis-(key-value|options|mirrors|specs)-conf %{ - require-module paludis +hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{ + add-highlighter window/exheres-0-metadata ref exheres-0-metadata + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-metadata } } -hook -once global BufSetOption filetype=glep42 %{ - require-module glep42 +hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{ + add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-options-descriptions } +} + +hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{ + add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups } } provide-module exheres %{ @@ -47,11 +54,6 @@ add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?[\S]+[\s\t]+=[\s\t add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?\]\]$ 0:type -hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{ - add-highlighter window/exheres-0-metadata ref exheres-0-metadata - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-metadata } -} - ## exheres-0 options descriptions add-highlighter shared/exheres-0-options-descriptions group add-highlighter shared/exheres-0-options-descriptions/ regex ^#.*?$ 0:comment @@ -59,23 +61,36 @@ add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?[\S]+[ add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?\]\]$ 0:type -hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{ - add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-options-descriptions } -} - ## metadata/licence_groups.conf add-highlighter shared/exheres-0-licence-groups group add-highlighter shared/exheres-0-licence-groups/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute add-highlighter shared/exheres-0-licence-groups/ regex ^(\S+) 0:type add-highlighter shared/exheres-0-licence-groups/ regex ^#.*?$ 0:comment - -hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{ - add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups } -} } +hook global WinSetOption filetype=paludis-(key-value|options|mirrors|specs)-conf %{ + require-module paludis +} + +hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ + add-highlighter window/paludis-options-conf ref paludis-options-conf + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-options-conf } +} + +hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{ + add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-key-value-conf } +} + +hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ + add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-mirrors-conf } +} + +hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ + add-highlighter window/paludis-specs-conf ref paludis-specs-conf + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-specs-conf } +} provide-module paludis %{ ## Paludis configurations ### options.conf @@ -88,41 +103,30 @@ add-highlighter shared/paludis-options-conf/ regex [\s\t](-\S+)(.*?) 1:red add-highlighter shared/paludis-options-conf/ regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-options-conf/ regex ^#.*?$ 0:comment -hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{ - add-highlighter window/paludis-options-conf ref paludis-options-conf - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-options-conf } -} - ## general.conf, repository.template add-highlighter shared/paludis-key-value-conf group add-highlighter shared/paludis-key-value-conf/ regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value add-highlighter shared/paludis-key-value-conf/ regex ^#.*?$ 0:comment -hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{ - add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-key-value-conf } -} - ## mirrors.conf add-highlighter shared/paludis-mirrors-conf group add-highlighter shared/paludis-mirrors-conf/ regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value add-highlighter shared/paludis-mirrors-conf/ regex ^#.*?$ 0:comment -hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{ - add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-mirrors-conf } -} - ## package_(unmask|mask).conf, platforms.conf add-highlighter shared/paludis-specs-conf group add-highlighter shared/paludis-specs-conf/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute add-highlighter shared/paludis-specs-conf/ regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-specs-conf/ regex ^#.*?$ 0:comment - -hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{ - add-highlighter window/paludis-specs-conf ref paludis-specs-conf - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-specs-conf } } + +hook global WinSetOption filetype=glep42 %{ + require-module glep42 +} + +hook -group glep42-highlight global WinSetOption filetype=glep42 %{ + add-highlighter window/glep42 ref glep42 + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/glep42 } } provide-module glep42 %{ @@ -131,9 +135,4 @@ add-highlighter shared/glep42 group add-highlighter shared/glep42/ regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute add-highlighter shared/glep42/ regex <[^@>]+@.*?> 0:string add-highlighter shared/glep42/ regex ^>.*?$ 0:comment - -hook -group glep42-highlight global WinSetOption filetype=glep42 %{ - add-highlighter window/glep42 ref glep42 - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/glep42 } -} } diff --git a/rc/filetype/gas.kak b/rc/filetype/gas.kak index ba32472a..67c25a85 100644 --- a/rc/filetype/gas.kak +++ b/rc/filetype/gas.kak @@ -4,10 +4,19 @@ hook global BufCreate .*\.(s|S|asm)$ %{ set-option buffer filetype gas } -hook -once global BufSetOption filetype=gas %{ +hook global WinSetOption filetype=gas %{ require-module gas + + hook window InsertChar \n -group gas-indent gas-indent-on-new-line + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ } } +hook -group gas-highlight global WinSetOption filetype=gas %{ + add-highlighter window/gas ref gas + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gas } +} + + provide-module gas %{ add-highlighter shared/gas regions @@ -86,14 +95,4 @@ define-command -hidden gas-indent-on-new-line %~ > ~ -hook -group gas-highlight global WinSetOption filetype=gas %{ - add-highlighter window/gas ref gas - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gas } -} - -hook global WinSetOption filetype=gas %{ - hook window InsertChar \n -group gas-indent gas-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ } -} - } diff --git a/rc/filetype/haml.kak b/rc/filetype/haml.kak index c802e1ff..f13c8764 100644 --- a/rc/filetype/haml.kak +++ b/rc/filetype/haml.kak @@ -8,10 +8,24 @@ hook global BufCreate .*[.](haml) %{ set-option buffer filetype haml } -hook -once global BufSetOption filetype=haml %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=haml %{ require-module haml + + hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent + hook window InsertChar \n -group haml-indent haml-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ } } +hook -group haml-highlight global WinSetOption filetype=haml %{ + add-highlighter window/haml ref haml + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haml } +} + + provide-module haml %[ require-module ruby require-module coffee @@ -55,19 +69,4 @@ define-command -hidden haml-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group haml-highlight global WinSetOption filetype=haml %{ - add-highlighter window/haml ref haml - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haml } -} - -hook global WinSetOption filetype=haml %{ - hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent - hook window InsertChar \n -group haml-indent haml-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ } -} - ] diff --git a/rc/filetype/hbs.kak b/rc/filetype/hbs.kak index d21f8d52..2474baf3 100644 --- a/rc/filetype/hbs.kak +++ b/rc/filetype/hbs.kak @@ -8,10 +8,25 @@ hook global BufCreate .*[.](hbs) %{ set-option buffer filetype hbs } -hook -once global BufSetOption filetype=hbs %{ +hook global WinSetOption filetype=hbs %{ require-module hbs + + hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent + hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line + hook window InsertChar .* -group hbs-indent hbs-indent-on-char + hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than + hook window InsertChar \n -group hbs-indent html-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window hbs-.+ } } +hook -group hbs-highlight global WinSetOption filetype=hbs %{ + maybe-add-hbs-to-html + add-highlighter window/hbs-file ref hbs-file + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hbs-file } +} + + provide-module hbs %[ # Highlighters @@ -86,20 +101,4 @@ define-command -hidden maybe-add-hbs-to-html %{ evaluate-commands %sh{ fi } } -hook -group hbs-highlight global WinSetOption filetype=hbs %{ - maybe-add-hbs-to-html - add-highlighter window/hbs-file ref hbs-file - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hbs-file } -} - -hook global WinSetOption filetype=hbs %{ - hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent - hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line - hook window InsertChar .* -group hbs-indent hbs-indent-on-char - hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than - hook window InsertChar \n -group hbs-indent html-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window hbs-.+ } -} - ] diff --git a/rc/filetype/i3.kak b/rc/filetype/i3.kak index 16819cf7..b46a2388 100644 --- a/rc/filetype/i3.kak +++ b/rc/filetype/i3.kak @@ -2,11 +2,27 @@ hook global BufCreate .*(sway|i3)/config %{ set buffer filetype i3 } -hook -once global BufSetOption filetype=i3 %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=i3 %[ require-module i3 + + # cleanup trailing whitespaces when exiting insert mode + hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } + hook window InsertChar \n -group i3-indent i3-indent-on-new-line + hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window i3-.+ } +] + +hook -group i3-highlight global WinSetOption filetype=i3 %{ + add-highlighter window/i3 ref i3 + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/i3 } } -provide-module i3 %{ + +provide-module i3 %[ add-highlighter shared/i3 regions add-highlighter shared/i3/code default-region group @@ -69,21 +85,4 @@ define-command -hidden i3-indent-on-closing-curly-brace %[ try %[ execute-keys -itersel -draft ^\h+\}$hms\A|.\z1 ] ] -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group i3-highlight global WinSetOption filetype=i3 %{ - add-highlighter window/i3 ref i3 - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/i3 } -} - -hook global WinSetOption filetype=i3 %[ - # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } - hook window InsertChar \n -group i3-indent i3-indent-on-new-line - hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window i3-.+ } ] - -} diff --git a/rc/filetype/ini.kak b/rc/filetype/ini.kak index 24bae58d..7e070176 100644 --- a/rc/filetype/ini.kak +++ b/rc/filetype/ini.kak @@ -2,10 +2,16 @@ hook global BufCreate .+\.(repo|ini|cfg|properties) %{ set-option buffer filetype ini } -hook -once global BufSetOption filetype=ini %{ +hook global WinSetOption filetype=ini %{ require-module ini } +hook -group ini-highlight global WinSetOption filetype=ini %{ + add-highlighter window/ini ref ini + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini } +} + + provide-module ini %{ add-highlighter shared/ini regions @@ -15,9 +21,4 @@ add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment add-highlighter shared/ini/code/ regex "^\h*\[[^\]]*\]" 0:title add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value -hook -group ini-highlight global WinSetOption filetype=ini %{ - add-highlighter window/ini ref ini - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini } -} - } diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index 21c28858..36d4e3ba 100644 --- a/rc/filetype/java.kak +++ b/rc/filetype/java.kak @@ -2,10 +2,27 @@ hook global BufCreate .*\.java %{ set-option buffer filetype java } -hook -once global BufSetOption filetype=java %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=java %{ require-module java + + # cleanup trailing whitespaces when exiting insert mode + hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } + hook window InsertChar \n -group java-indent java-indent-on-new-line + hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace + hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-.+ } } +hook -group java-highlight global WinSetOption filetype=java %{ + add-highlighter window/java ref java + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/java } +} + + provide-module java %🦀 add-highlighter shared/java regions @@ -52,22 +69,4 @@ define-command -hidden java-indent-on-closing-curly-brace %[ try %[ execute-keys -itersel -draft ^\h+\}$hms\A|.\z1 ] ] -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group java-highlight global WinSetOption filetype=java %{ - add-highlighter window/java ref java - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/java } -} - -hook global WinSetOption filetype=java %{ - # cleanup trailing whitespaces when exiting insert mode - hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft s^\h+$d } } - hook window InsertChar \n -group java-indent java-indent-on-new-line - hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace - hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-.+ } -} - 🦀 diff --git a/rc/filetype/julia.kak b/rc/filetype/julia.kak index ade63480..10edb743 100644 --- a/rc/filetype/julia.kak +++ b/rc/filetype/julia.kak @@ -8,10 +8,19 @@ hook global BufCreate .*\.(jl) %{ set-option buffer filetype julia } -hook -once global BufSetOption filetype=julia %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=julia %{ require-module julia } +hook -group julia-highlight global WinSetOption filetype=julia %{ + add-highlighter window/julia ref julia + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia } +} + + provide-module julia %{ # Highlighters @@ -27,12 +36,4 @@ add-highlighter shared/julia/code/ regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|Na add-highlighter shared/julia/code/ regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword add-highlighter shared/julia/code/ regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|AbstractString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group julia-highlight global WinSetOption filetype=julia %{ - add-highlighter window/julia ref julia - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia } -} - } diff --git a/rc/filetype/just.kak b/rc/filetype/just.kak index 63a847d7..f81f0b58 100644 --- a/rc/filetype/just.kak +++ b/rc/filetype/just.kak @@ -5,10 +5,19 @@ hook global BufCreate .*/?[jJ]ustfile %{ set-option buffer filetype justfile } -hook -once global BufSetOption 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 @@ -43,14 +52,4 @@ add-highlighter shared/justfile/content/ regex '^(@)?([\w-]+)(?:\s(.+))?\s?(:)(. add-highlighter shared/justfile/content/ regex '([=+])' 1:operator add-highlighter shared/justfile/content/ regex '^([\w-]+)\s=' 1:value -hook -group justfile-highlight global WinSetOption filetype=justfile %{ - add-highlighter window/justfile ref justfile - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/justfile } -} - -hook global WinSetOption filetype=justfile %{ - hook window InsertChar \n -group justfile-indent just-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window justfile-.+ } -} - } diff --git a/rc/filetype/kickstart.kak b/rc/filetype/kickstart.kak index c939a252..0e7441b1 100644 --- a/rc/filetype/kickstart.kak +++ b/rc/filetype/kickstart.kak @@ -2,10 +2,16 @@ hook global BufCreate .*\.ks %{ set-option buffer filetype kickstart } -hook -once global BufSetOption filetype=kickstart %{ +hook global WinSetOption filetype=kickstart %{ require-module kickstart } +hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ + add-highlighter window/kickstart ref kickstart + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart } +} + + provide-module kickstart %{ add-highlighter shared/kickstart regions @@ -29,10 +35,4 @@ add-highlighter shared/kickstart/shell/ regex '\A\h*\K%(pre-install|pre|post)\b' add-highlighter shared/kickstart/shell/ regex '^\h*%end\b' 0:type add-highlighter shared/kickstart/shell/ ref sh - -hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ - add-highlighter window/kickstart ref kickstart - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart } -} - } diff --git a/rc/filetype/markdown.kak b/rc/filetype/markdown.kak index be193269..ab380b7f 100644 --- a/rc/filetype/markdown.kak +++ b/rc/filetype/markdown.kak @@ -8,10 +8,22 @@ hook global BufCreate .*[.](markdown|md|mkd) %{ set-option buffer filetype markdown } -hook -once global BufSetOption filetype=markdown %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=markdown %{ require-module markdown + + hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ } } +hook -group markdown-highlight global WinSetOption filetype=markdown %{ + add-highlighter window/markdown ref markdown + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown } +} + + provide-module markdown %{ # Highlighters @@ -77,17 +89,4 @@ define-command -hidden markdown-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group markdown-highlight global WinSetOption filetype=markdown %{ - add-highlighter window/markdown ref markdown - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown } -} - -hook global WinSetOption filetype=markdown %{ - hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ } -} - } diff --git a/rc/filetype/mercurial.kak b/rc/filetype/mercurial.kak index 5c014ee7..f21cd202 100644 --- a/rc/filetype/mercurial.kak +++ b/rc/filetype/mercurial.kak @@ -8,10 +8,15 @@ hook global BufCreate .*hg-editor-\w+\.txt$ %{ set-option buffer filetype hg-commit } -hook -once global BufSetOption filetype=hg-commit %{ +hook global WinSetOption filetype=hg-commit %{ require-module hg-commit } +hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{ + add-highlighter window/hg-commit ref hg-commit + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight } +} + provide-module hg-commit %{ # Faces @@ -22,10 +27,7 @@ set-face global MercurialCommitComment cyan # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{ - add-highlighter window/ group hg-commit-highlight - add-highlighter window/hg-commit-highlight regex '^HG:[^\n]*' 0:comment - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight } -} +add-highlighter shared/hg-commit group +add-highlighter shared/hg-commit/ regex '^HG:[^\n]*' 0:comment } diff --git a/rc/filetype/moon.kak b/rc/filetype/moon.kak index 1963905b..1ff48f38 100644 --- a/rc/filetype/moon.kak +++ b/rc/filetype/moon.kak @@ -8,10 +8,30 @@ hook global BufCreate .*[.](moon) %{ set-option buffer filetype moon } -hook -once global BufSetOption filetype=moon %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=moon %{ require-module moon + + hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent + hook window InsertChar .* -group moon-indent moon-indent-on-char + hook window InsertChar \n -group moon-indent moon-indent-on-new-line + + alias window alt moon-alternative-file + + hook -once -always window WinSetOption filetype=.* %{ + remove-hooks window moon-.+ + unalias window alt moon-alternative-file + } } +hook -group moon-highlight global WinSetOption filetype=moon %{ + add-highlighter window/moon ref moon + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/moon } +} + + provide-module moon %[ # Highlighters @@ -91,25 +111,4 @@ define-command -hidden moon-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group moon-highlight global WinSetOption filetype=moon %{ - add-highlighter window/moon ref moon - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/moon } -} - -hook global WinSetOption filetype=moon %{ - hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent - hook window InsertChar .* -group moon-indent moon-indent-on-char - hook window InsertChar \n -group moon-indent moon-indent-on-new-line - - alias window alt moon-alternative-file - - hook -once -always window WinSetOption filetype=.* %{ - remove-hooks window moon-.+ - unalias window alt moon-alternative-file - } -} - ] diff --git a/rc/filetype/restructuredtext.kak b/rc/filetype/restructuredtext.kak index 362c9806..29fc32a9 100644 --- a/rc/filetype/restructuredtext.kak +++ b/rc/filetype/restructuredtext.kak @@ -5,10 +5,18 @@ hook global BufCreate .*[.](rst) %{ set-option buffer filetype restructuredtext } -hook -once global BufSetOption filetype=restructuredtext %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=restructuredtext %{ require-module restructuredtext } +hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{ + add-highlighter window/restructuredtext ref restructuredtext + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext } +} + provide-module restructuredtext %{ # Highlighters @@ -71,12 +79,4 @@ add-highlighter shared/restructuredtext/content/ regex [^*](\*\*([^\s*]|([^\s*][ add-highlighter shared/restructuredtext/content/ regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic add-highlighter shared/restructuredtext/content/ regex [^`](``([^\s`]|([^\s`][^`]*[^\s`]))``)[^`] 1:mono -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{ - add-highlighter window/restructuredtext ref restructuredtext - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext } -} - } diff --git a/rc/filetype/taskpaper.kak b/rc/filetype/taskpaper.kak index 1e5cb321..3cd97808 100644 --- a/rc/filetype/taskpaper.kak +++ b/rc/filetype/taskpaper.kak @@ -8,10 +8,22 @@ hook global BufCreate .*\.taskpaper %{ set-option buffer filetype taskpaper } -hook -once global BufSetOption filetype=taskpaper %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=taskpaper %{ require-module taskpaper + + hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ } } +hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ + add-highlighter window/taskpaper ref taskpaper + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper } +} + + provide-module taskpaper %{ # Highlighters @@ -39,17 +51,4 @@ define-command -hidden taskpaper-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ - add-highlighter window/taskpaper ref taskpaper - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper } -} - -hook global WinSetOption filetype=taskpaper %{ - hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ } -} - } diff --git a/rc/filetype/toml.kak b/rc/filetype/toml.kak index 141a21fd..4a7ad81c 100644 --- a/rc/filetype/toml.kak +++ b/rc/filetype/toml.kak @@ -8,10 +8,24 @@ hook global BufCreate .*\.(toml) %{ set-option buffer filetype toml } -hook -once global BufSetOption filetype=toml %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=toml %{ require-module toml + + hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent + hook window InsertChar \n -group toml-indent toml-indent-on-new-line + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ } } +hook -group toml-highlight global WinSetOption filetype=toml %{ + add-highlighter window/toml ref toml + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/toml } +} + + provide-module toml %{ # Highlighters @@ -53,19 +67,4 @@ define-command -hidden toml-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group toml-highlight global WinSetOption filetype=toml %{ - add-highlighter window/toml ref toml - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/toml } -} - -hook global WinSetOption filetype=toml %{ - hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent - hook window InsertChar \n -group toml-indent toml-indent-on-new-line - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ } -} - } diff --git a/rc/filetype/yaml.kak b/rc/filetype/yaml.kak index 8e0f3487..ac8a9823 100644 --- a/rc/filetype/yaml.kak +++ b/rc/filetype/yaml.kak @@ -8,10 +8,23 @@ hook global BufCreate .*[.](ya?ml) %{ set-option buffer filetype yaml } -hook -once global BufSetOption filetype=yaml %{ +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=yaml %{ require-module yaml + + hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent + hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ } } +hook -group yaml-highlight global WinSetOption filetype=yaml %{ + add-highlighter window/yaml ref yaml + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/yaml } +} + + provide-module yaml %{ # Highlighters @@ -49,18 +62,4 @@ define-command -hidden yaml-indent-on-new-line %{ } } -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group yaml-highlight global WinSetOption filetype=yaml %{ - add-highlighter window/yaml ref yaml - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/yaml } -} - -hook global WinSetOption filetype=yaml %{ - hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent - hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ } -} - }