From f4b6665b3d8808dbea2e67795ab7b3a8e0c2f3ed Mon Sep 17 00:00:00 2001 From: pascal Date: Mon, 28 Jul 2025 14:04:56 +0100 Subject: [PATCH 1/7] wrap SML detection in module to allow specification of order with ModuleLoaded hook --- rc/filetype/sml.kak | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rc/filetype/sml.kak b/rc/filetype/sml.kak index 961d58db67..9932edee82 100644 --- a/rc/filetype/sml.kak +++ b/rc/filetype/sml.kak @@ -4,10 +4,16 @@ # Detection # ‾‾‾‾‾‾‾‾‾ +provide-module detect-sml %{ + hook global BufCreate .*\.(sml|fun|sig) %{ set-option buffer filetype sml } +} + +require-module detect-sml + # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ From 712489471e28f94658dc48a0a757b5f7ee993e67 Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 29 Jul 2025 12:19:07 +0100 Subject: [PATCH 2/7] include filetype hooks in detect-sml module --- rc/filetype/sml.kak | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc/filetype/sml.kak b/rc/filetype/sml.kak index 9932edee82..830c56072f 100644 --- a/rc/filetype/sml.kak +++ b/rc/filetype/sml.kak @@ -10,10 +10,6 @@ hook global BufCreate .*\.(sml|fun|sig) %{ set-option buffer filetype sml } -} - -require-module detect-sml - # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ @@ -28,6 +24,10 @@ hook -group sml-highlight global WinSetOption filetype=sml %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sml } } +} + +require-module detect-sml + provide-module sml %[ # Highlighters From 197399578a2b15a729de27975ef8c69587d71685 Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 29 Jul 2025 12:23:14 +0100 Subject: [PATCH 3/7] mail detection module and ret map hook group --- rc/filetype/mail.kak | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rc/filetype/mail.kak b/rc/filetype/mail.kak index b6ef616fe7..22aa702835 100644 --- a/rc/filetype/mail.kak +++ b/rc/filetype/mail.kak @@ -1,8 +1,10 @@ +provide-module detect-mail %{ + hook global BufCreate .+\.eml %{ set-option buffer filetype mail } -hook global WinSetOption filetype=mail %{ +hook -group mail-ret-map global WinSetOption filetype=mail %{ require-module mail map buffer normal :diff-jump hook -once -always window WinSetOption filetype=.* %{ @@ -15,6 +17,10 @@ hook -group mail-highlight global WinSetOption filetype=mail %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mail } } +} + +require-module detect-mail + provide-module mail %{ From 76185d8abeda7872c5abca57ae468e2b880423e3 Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 29 Jul 2025 12:26:39 +0100 Subject: [PATCH 4/7] Pascal Lasnier Copyright Waiver I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. From 64102fe53ae8a298e3290a0b973fcc93411e5ce1 Mon Sep 17 00:00:00 2001 From: pascal Date: Fri, 8 Aug 2025 22:40:50 +0100 Subject: [PATCH 5/7] wrapped all filetype detection in modules --- rc/filetype/apl.kak | 5 +++++ rc/filetype/arch-linux.kak | 7 +++++++ rc/filetype/asciidoc.kak | 6 ++++++ rc/filetype/awk.kak | 6 ++++++ rc/filetype/c-family.kak | 6 ++++++ rc/filetype/cabal.kak | 6 ++++++ rc/filetype/clojure.kak | 6 ++++++ rc/filetype/cmake.kak | 6 ++++++ rc/filetype/coffee.kak | 6 ++++++ rc/filetype/conf.kak | 6 ++++++ rc/filetype/coq.kak | 5 +++++ rc/filetype/crystal.kak | 6 ++++++ rc/filetype/css.kak | 6 ++++++ rc/filetype/cucumber.kak | 6 ++++++ rc/filetype/cue.kak | 6 ++++++ rc/filetype/d.kak | 6 ++++++ rc/filetype/dart.kak | 6 ++++++ rc/filetype/dhall.kak | 6 ++++++ rc/filetype/diff.kak | 6 ++++++ rc/filetype/dockerfile.kak | 6 ++++++ rc/filetype/elixir.kak | 6 ++++++ rc/filetype/elm.kak | 6 ++++++ rc/filetype/elvish.kak | 6 ++++++ rc/filetype/erlang.kak | 6 ++++++ rc/filetype/eruby.kak | 6 ++++++ rc/filetype/etc.kak | 6 ++++++ rc/filetype/exherbo.kak | 6 ++++++ rc/filetype/fennel.kak | 6 ++++++ rc/filetype/fidl.kak | 6 ++++++ rc/filetype/fish.kak | 6 ++++++ rc/filetype/forth.kak | 6 ++++++ rc/filetype/fsharp.kak | 6 ++++++ rc/filetype/gas.kak | 6 ++++++ rc/filetype/gdscript.kak | 6 ++++++ rc/filetype/gentoo-linux.kak | 6 ++++++ rc/filetype/git.kak | 6 ++++++ rc/filetype/github.kak | 6 ++++++ rc/filetype/gjs.kak | 6 ++++++ rc/filetype/gleam.kak | 6 ++++++ rc/filetype/gluon.kak | 6 ++++++ rc/filetype/go.kak | 6 ++++++ rc/filetype/graphql.kak | 6 ++++++ rc/filetype/gren.kak | 6 ++++++ rc/filetype/groovy.kak | 6 ++++++ rc/filetype/haml.kak | 6 ++++++ rc/filetype/hare.kak | 6 ++++++ rc/filetype/haskell.kak | 6 ++++++ rc/filetype/hbs.kak | 6 ++++++ rc/filetype/html.kak | 6 ++++++ rc/filetype/i3.kak | 6 ++++++ rc/filetype/ini.kak | 6 ++++++ rc/filetype/janet.kak | 6 ++++++ rc/filetype/java.kak | 6 ++++++ rc/filetype/javascript.kak | 6 ++++++ rc/filetype/json.kak | 6 ++++++ rc/filetype/julia.kak | 6 ++++++ rc/filetype/just.kak | 6 ++++++ rc/filetype/kakrc.kak | 6 ++++++ rc/filetype/kickstart.kak | 6 ++++++ rc/filetype/kotlin.kak | 6 ++++++ rc/filetype/latex.kak | 6 ++++++ rc/filetype/ledger.kak | 6 ++++++ rc/filetype/lisp.kak | 6 ++++++ rc/filetype/lua.kak | 6 ++++++ rc/filetype/makefile.kak | 6 ++++++ rc/filetype/markdown.kak | 6 ++++++ rc/filetype/mercurial.kak | 6 ++++++ rc/filetype/mercury.kak | 6 ++++++ rc/filetype/meson.kak | 6 ++++++ rc/filetype/mlb.kak | 6 ++++++ rc/filetype/moon.kak | 6 ++++++ rc/filetype/nim.kak | 6 ++++++ rc/filetype/ninja.kak | 6 ++++++ rc/filetype/nix.kak | 6 ++++++ rc/filetype/ocaml.kak | 6 ++++++ rc/filetype/odin.kak | 6 ++++++ rc/filetype/pascal.kak | 7 +++++++ rc/filetype/perf.kak | 12 ++++++++++++ rc/filetype/perl.kak | 6 ++++++ rc/filetype/php.kak | 6 ++++++ rc/filetype/pony.kak | 6 ++++++ rc/filetype/prolog.kak | 7 +++++++ rc/filetype/protobuf.kak | 6 ++++++ rc/filetype/prql.kak | 6 ++++++ rc/filetype/pug.kak | 6 ++++++ rc/filetype/purescript.kak | 6 ++++++ rc/filetype/python.kak | 6 ++++++ rc/filetype/r.kak | 6 ++++++ rc/filetype/ragel.kak | 6 ++++++ rc/filetype/restructuredtext.kak | 6 ++++++ rc/filetype/ruby.kak | 6 ++++++ rc/filetype/rust.kak | 6 ++++++ rc/filetype/sass.kak | 6 ++++++ rc/filetype/scala.kak | 6 ++++++ rc/filetype/scheme.kak | 6 ++++++ rc/filetype/scss.kak | 6 ++++++ rc/filetype/sh.kak | 6 ++++++ rc/filetype/sml.kak | 4 ++-- rc/filetype/sql.kak | 6 ++++++ rc/filetype/svelte.kak | 6 ++++++ rc/filetype/swift.kak | 6 ++++++ rc/filetype/systemd.kak | 6 ++++++ rc/filetype/taskpaper.kak | 6 ++++++ rc/filetype/tcl.kak | 6 ++++++ rc/filetype/terraform.kak | 6 ++++++ rc/filetype/toml.kak | 6 ++++++ rc/filetype/troff.kak | 6 ++++++ rc/filetype/ttl.kak | 6 ++++++ rc/filetype/tupfile.kak | 6 ++++++ rc/filetype/twig.kak | 6 ++++++ rc/filetype/typst.kak | 6 ++++++ rc/filetype/vhdl.kak | 6 ++++++ rc/filetype/void-linux.kak | 7 +++++++ rc/filetype/wren.kak | 6 ++++++ rc/filetype/yaml.kak | 6 ++++++ rc/filetype/zig.kak | 6 ++++++ 116 files changed, 700 insertions(+), 2 deletions(-) diff --git a/rc/filetype/apl.kak b/rc/filetype/apl.kak index ff3f2f0310..204b1791db 100644 --- a/rc/filetype/apl.kak +++ b/rc/filetype/apl.kak @@ -1,3 +1,4 @@ +provide-module detect-apl %@ # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +27,10 @@ hook -group apl-highlight global WinSetOption filetype=apl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/apl } } +@ + +require-module detect-apl + provide-module apl %¹ # Highlighters & Completion diff --git a/rc/filetype/arch-linux.kak b/rc/filetype/arch-linux.kak index 08135a7638..7723ab36dc 100644 --- a/rc/filetype/arch-linux.kak +++ b/rc/filetype/arch-linux.kak @@ -1,4 +1,11 @@ # package build description file + +provide-module detect-arch-linux %{ + hook global BufCreate (.*/)?PKGBUILD %{ set-option buffer filetype sh } + +} + +require-module detect-arch-linux diff --git a/rc/filetype/asciidoc.kak b/rc/filetype/asciidoc.kak index 453ffd4ac8..2bcf1f6409 100644 --- a/rc/filetype/asciidoc.kak +++ b/rc/filetype/asciidoc.kak @@ -1,6 +1,8 @@ # http://asciidoc.org/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-asciidoc %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -18,6 +20,10 @@ hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc } } +} + +require-module detect-asciidoc + provide-module asciidoc %{ # Highlighters diff --git a/rc/filetype/awk.kak b/rc/filetype/awk.kak index 536e352858..283999fc62 100644 --- a/rc/filetype/awk.kak +++ b/rc/filetype/awk.kak @@ -1,3 +1,5 @@ +provide-module detect-awk %{ + # Detection # --------- @@ -22,6 +24,10 @@ hook -group awk-highlight global WinSetOption filetype=awk %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/awk } } +} + +require-module detect-awk + provide-module awk %@ # Highlighters diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 0677b11e99..b14db9f0fe 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -1,3 +1,5 @@ +provide-module detect-c-family %[ + # Detection hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{ set-option buffer filetype cpp @@ -59,6 +61,10 @@ hook -group objc-highlight global WinSetOption filetype=objc %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc } } +] + +require-module detect-c-family + provide-module c-family %§ diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index a1f452614e..2511181e5e 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -1,6 +1,8 @@ # http://haskell.org/cabal # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-cabal %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group cabal-highlight global WinSetOption filetype=cabal %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cabal } } +] + +require-module detect-cabal + provide-module cabal %[ diff --git a/rc/filetype/clojure.kak b/rc/filetype/clojure.kak index d876262a26..f2daac889d 100644 --- a/rc/filetype/clojure.kak +++ b/rc/filetype/clojure.kak @@ -1,6 +1,8 @@ # http://clojure.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-clojure %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -25,6 +27,10 @@ hook -group clojure-insert global BufNewFile .*[.](clj|cljc|cljs|cljx) %{ clojure-insert-ns } +} + +require-module detect-clojure + provide-module clojure %{ require-module lisp diff --git a/rc/filetype/cmake.kak b/rc/filetype/cmake.kak index 86fda25dad..a3dd7149c7 100644 --- a/rc/filetype/cmake.kak +++ b/rc/filetype/cmake.kak @@ -1,3 +1,5 @@ +provide-module detect-cmake %{ + hook global BufCreate .+\.cmake|.*/CMakeLists.txt %{ set-option buffer filetype cmake } @@ -15,6 +17,10 @@ hook -group cmake-highlight global WinSetOption filetype=cmake %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake } } +} + +require-module detect-cmake + provide-module cmake %{ add-highlighter shared/cmake regions diff --git a/rc/filetype/coffee.kak b/rc/filetype/coffee.kak index c9ee330ce0..166d4c0dc5 100644 --- a/rc/filetype/coffee.kak +++ b/rc/filetype/coffee.kak @@ -1,6 +1,8 @@ # http://coffeescript.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-coffee %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group coffee-highlight global WinSetOption filetype=coffee %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/coffee } } +} + +require-module detect-coffee + provide-module coffee %[ diff --git a/rc/filetype/conf.kak b/rc/filetype/conf.kak index 9b715893e2..51bb7e0773 100644 --- a/rc/filetype/conf.kak +++ b/rc/filetype/conf.kak @@ -1,3 +1,5 @@ +provide-module detect-conf %{ + hook global BufCreate .+\.(repo|cfg|properties|desktop) %{ set-option buffer filetype conf } @@ -18,6 +20,10 @@ hook -group conf-highlight global WinSetOption filetype=conf %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/conf } } +} + +require-module detect-conf + provide-module conf %{ add-highlighter shared/conf regions diff --git a/rc/filetype/coq.kak b/rc/filetype/coq.kak index cab1abf8e4..62b8dcc90f 100644 --- a/rc/filetype/coq.kak +++ b/rc/filetype/coq.kak @@ -1,3 +1,4 @@ +provide-module detect-coq %{ # Detection # -------- @@ -23,6 +24,10 @@ hook global WinSetOption filetype=coq %{ } } +} + +require-module detect-coq + provide-module coq %{ # Syntax diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index e3540678e7..d860f06913 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -1,6 +1,8 @@ # Crystal # https://crystal-lang.org +provide-module detect-crystal %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook global WinSetOption filetype=crystal %{ } } +} + +require-module detect-crystal + provide-module crystal %§ declare-option -hidden str-list crystal_keywords 'abstract' 'alias' 'annotation' 'as' 'asm' 'begin' 'break' 'case' 'class' 'def' 'do' 'else' 'elsif' 'end' 'ensure' 'enum' 'extend' 'false' 'for' 'fun' 'if' 'include' 'instance_sizeof' 'is_a?' 'lib' 'macro' 'module' 'next' 'nil' 'nil?' 'of' 'offsetof' 'out' 'pointerof' 'private' 'protected' 'require' 'rescue' 'responds_to?' 'return' 'select' 'self' 'sizeof' 'struct' 'super' 'then' 'true' 'type' 'typeof' 'uninitialized' 'union' 'unless' 'until' 'verbatim' 'when' 'while' 'with' 'yield' diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index b498a43f57..4164a96983 100644 --- a/rc/filetype/css.kak +++ b/rc/filetype/css.kak @@ -1,6 +1,8 @@ # http://w3.org/Style/CSS # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-css %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group css-highlight global WinSetOption filetype=css %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/css } } +] + +require-module detect-css + provide-module css %[ diff --git a/rc/filetype/cucumber.kak b/rc/filetype/cucumber.kak index f8f54152ca..9ad47cfca3 100644 --- a/rc/filetype/cucumber.kak +++ b/rc/filetype/cucumber.kak @@ -1,6 +1,8 @@ # http://cukes.info # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-cucumber %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cucumber } } +} + +require-module detect-cucumber + provide-module cucumber %{ diff --git a/rc/filetype/cue.kak b/rc/filetype/cue.kak index f4008377a7..cbce9f2066 100644 --- a/rc/filetype/cue.kak +++ b/rc/filetype/cue.kak @@ -1,6 +1,8 @@ # https://cuelang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-cue %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group cue-highlight global WinSetOption filetype=cue %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cue } } +] + +require-module detect-cue + provide-module cue %§ # Highlighters diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 359c1ca9b8..def133dd9a 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -1,6 +1,8 @@ # http://dlang.org/ # +provide-module detect-d %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -31,6 +33,10 @@ hook -group d-highlight global WinSetOption filetype=d %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/d } } +} + +require-module detect-d + provide-module d %§ # Highlighters diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index d662359175..df42efacab 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -1,6 +1,8 @@ # https://dartlang.org/ # +provide-module detect-dart %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -31,6 +33,10 @@ hook -group dart-highlight global WinSetOption filetype=dart %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dart } } +} + +require-module detect-dart + provide-module dart %§ diff --git a/rc/filetype/dhall.kak b/rc/filetype/dhall.kak index 94b69d6660..8e03cd5546 100644 --- a/rc/filetype/dhall.kak +++ b/rc/filetype/dhall.kak @@ -1,6 +1,8 @@ # https://dhall-lang.org # +provide-module detect-dhall %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group dhall-highlight global WinSetOption filetype=dhall %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dhall } } +} + +require-module detect-dhall + provide-module dhall %[ diff --git a/rc/filetype/diff.kak b/rc/filetype/diff.kak index bd24c6d9f4..23948760e7 100644 --- a/rc/filetype/diff.kak +++ b/rc/filetype/diff.kak @@ -1,3 +1,5 @@ +provide-module detect-diff %{ + hook global BufCreate .*\.(diff|patch) %{ set-option buffer filetype diff } @@ -12,6 +14,10 @@ hook -group diff-highlight global WinSetOption filetype=diff %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/diff } } +} + +require-module detect-diff + provide-module diff %§ add-highlighter shared/diff group diff --git a/rc/filetype/dockerfile.kak b/rc/filetype/dockerfile.kak index a9000d82f3..c5cc433f98 100644 --- a/rc/filetype/dockerfile.kak +++ b/rc/filetype/dockerfile.kak @@ -3,6 +3,8 @@ # See https://docs.docker.com/reference/builder +provide-module detect-dockerfile %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -23,6 +25,10 @@ hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dockerfile } } +} + +require-module detect-dockerfile + provide-module dockerfile %{ # Highlighters diff --git a/rc/filetype/elixir.kak b/rc/filetype/elixir.kak index 8276f5b78f..513ad7baa5 100644 --- a/rc/filetype/elixir.kak +++ b/rc/filetype/elixir.kak @@ -1,6 +1,8 @@ # http://elixir-lang.org # ---------------------- +provide-module detect-elixir %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -41,6 +43,10 @@ hook -group eex-highlight global WinSetOption filetype=eex %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/eex } } +} + +require-module detect-elixir + provide-module eex %{ require-module html require-module elixir diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index 0bd5196765..e2126abc98 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -1,6 +1,8 @@ # http://elm-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-elm %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group elm-highlight global WinSetOption filetype=elm %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elm } } +} + +require-module detect-elm + provide-module elm %[ diff --git a/rc/filetype/elvish.kak b/rc/filetype/elvish.kak index 537786263c..fbb8a8208b 100644 --- a/rc/filetype/elvish.kak +++ b/rc/filetype/elvish.kak @@ -1,5 +1,7 @@ # Syntax highlighting and indentation for Elvish (https://elv.sh) +provide-module detect-elvish %< + hook global BufCreate .*\.elv %{ set-option buffer filetype elvish } @@ -18,6 +20,10 @@ hook -group elvish-highlight global WinSetOption filetype=elvish %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elvish } } +> + +require-module detect-elvish + provide-module elvish %§ add-highlighter shared/elvish regions diff --git a/rc/filetype/erlang.kak b/rc/filetype/erlang.kak index 35b60cf20e..02f78e6cb4 100644 --- a/rc/filetype/erlang.kak +++ b/rc/filetype/erlang.kak @@ -4,6 +4,8 @@ # Detection and Initialization sections were adapted from rc/filetype/elixir.kak +provide-module detect-erlang %{ + # Detection # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](erl|hrl) %{ @@ -23,6 +25,10 @@ hook -group erlang-highlight global WinSetOption filetype=erlang %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/erlang } } +} + +require-module detect-erlang + provide-module erlang %[ # Highlighters diff --git a/rc/filetype/eruby.kak b/rc/filetype/eruby.kak index 9237be7361..58acdcbda3 100644 --- a/rc/filetype/eruby.kak +++ b/rc/filetype/eruby.kak @@ -1,6 +1,8 @@ # eRuby # http://www2a.biglobe.ne.jp/~seki/ruby/erb.html +provide-module detect-eruby %{ + hook global BufCreate '.*\.erb' %{ set-option buffer filetype eruby } @@ -15,6 +17,10 @@ hook global WinSetOption filetype=eruby %{ } } +} + +require-module detect-eruby + provide-module eruby %{ require-module ruby require-module html diff --git a/rc/filetype/etc.kak b/rc/filetype/etc.kak index b04b7b47bc..ccf768fd7d 100644 --- a/rc/filetype/etc.kak +++ b/rc/filetype/etc.kak @@ -1,3 +1,5 @@ +provide-module detect-etc %{ + # Highlighting for common files in /etc hook global BufCreate .*/etc/(hosts|networks|services) %{ set-option buffer filetype etc-hosts } hook global BufCreate .*/etc/resolv.conf %{ set-option buffer filetype etc-resolv-conf } @@ -46,6 +48,10 @@ hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-passwd } } +} + +require-module detect-etc + # Highlighters diff --git a/rc/filetype/exherbo.kak b/rc/filetype/exherbo.kak index 7271425541..94cd76de4d 100644 --- a/rc/filetype/exherbo.kak +++ b/rc/filetype/exherbo.kak @@ -1,3 +1,5 @@ +provide-module detect-exherbo %{ + ## Repository metadata files hook global BufCreate .*/metadata/mirrors\.conf %{ set-option buffer filetype paludis-mirrors-conf } hook global BufCreate .*/metadata/licence_groups.conf %{ set-option buffer filetype exheres-0-licence-groups } @@ -44,6 +46,10 @@ hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exhe hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups } } +} + +require-module detect-exherbo + provide-module exheres %{ # Highlighters ## exheres-0 Repository metadata files diff --git a/rc/filetype/fennel.kak b/rc/filetype/fennel.kak index f49b2f7be3..02fa57eb10 100644 --- a/rc/filetype/fennel.kak +++ b/rc/filetype/fennel.kak @@ -1,6 +1,8 @@ # http://fennel-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-fennel %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -20,6 +22,10 @@ hook -group fennel-highlight global WinSetOption filetype=fennel %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fennel } } +} + +require-module detect-fennel + provide-module fennel %{ require-module lisp diff --git a/rc/filetype/fidl.kak b/rc/filetype/fidl.kak index 351eeb419d..44e177f71c 100644 --- a/rc/filetype/fidl.kak +++ b/rc/filetype/fidl.kak @@ -1,3 +1,5 @@ +provide-module detect-fidl %< + # Detection hook global BufCreate .*\.fidl %{ set-option buffer filetype fidl @@ -16,6 +18,10 @@ hook -group fidl-highlight global WinSetOption filetype=fidl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fidl } } +> + +require-module detect-fidl + provide-module fidl %§ # Highlighters diff --git a/rc/filetype/fish.kak b/rc/filetype/fish.kak index 0bfcc4f07e..731a9833a0 100644 --- a/rc/filetype/fish.kak +++ b/rc/filetype/fish.kak @@ -1,6 +1,8 @@ # http://fishshell.com # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-fish %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group fish-highlight global WinSetOption filetype=fish %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fish } } +} + +require-module detect-fish + provide-module fish %{ diff --git a/rc/filetype/forth.kak b/rc/filetype/forth.kak index 7ec77d4be5..91b3b3c086 100644 --- a/rc/filetype/forth.kak +++ b/rc/filetype/forth.kak @@ -1,3 +1,5 @@ +provide-module detect-forth %{ + hook global BufCreate .+\.(fth|4th|fs|forth) %{ set-option buffer filetype forth } @@ -11,6 +13,10 @@ hook -group forth-highlight global WinSetOption filetype=forth %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/forth } } +} + +require-module detect-forth + provide-module forth %{ add-highlighter shared/forth regions diff --git a/rc/filetype/fsharp.kak b/rc/filetype/fsharp.kak index 64d6b2c083..189886f399 100644 --- a/rc/filetype/fsharp.kak +++ b/rc/filetype/fsharp.kak @@ -1,6 +1,8 @@ # https://fsharp.org/ # +provide-module detect-fsharp %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group fsharp-highlight global WinSetOption filetype=fsharp %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fsharp } } +} + +require-module detect-fsharp + provide-module fsharp %§ # Highlighters & Completion diff --git a/rc/filetype/gas.kak b/rc/filetype/gas.kak index 73f8db7e63..ae6fa331e6 100644 --- a/rc/filetype/gas.kak +++ b/rc/filetype/gas.kak @@ -1,3 +1,5 @@ +provide-module detect-gas %{ + # Detection # --------- hook global BufCreate .*\.(s|S|asm)$ %{ @@ -17,6 +19,10 @@ hook -group gas-highlight global WinSetOption filetype=gas %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gas } } +} + +require-module detect-gas + provide-module gas %{ diff --git a/rc/filetype/gdscript.kak b/rc/filetype/gdscript.kak index 842a51e7c6..8ad10a5f12 100644 --- a/rc/filetype/gdscript.kak +++ b/rc/filetype/gdscript.kak @@ -1,6 +1,8 @@ # http://godotengine.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-gdscript %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group gdscript-highlight global WinSetOption filetype=gdscript %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gdscript } } +} + +require-module detect-gdscript + provide-module gdscript %§ # Highlighters diff --git a/rc/filetype/gentoo-linux.kak b/rc/filetype/gentoo-linux.kak index 251dad161f..b7ea860ed5 100644 --- a/rc/filetype/gentoo-linux.kak +++ b/rc/filetype/gentoo-linux.kak @@ -1,4 +1,10 @@ # portage ebuild file +provide-module detect-gentoo-linux %{ + hook global BufCreate .*\.ebuild %{ set-option buffer filetype sh } + +} + +require-module detect-gentoo-linux diff --git a/rc/filetype/git.kak b/rc/filetype/git.kak index 4501162cd8..eee1745494 100644 --- a/rc/filetype/git.kak +++ b/rc/filetype/git.kak @@ -1,3 +1,5 @@ +provide-module detect-git %{ + hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{ set-option buffer filetype git-commit } @@ -42,6 +44,10 @@ hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-rebase } } +} + +require-module detect-git + provide-module git-commit %{ require-module diff add-highlighter shared/git-commit regions diff --git a/rc/filetype/github.kak b/rc/filetype/github.kak index 17e593a2f0..8359253bd8 100644 --- a/rc/filetype/github.kak +++ b/rc/filetype/github.kak @@ -1,3 +1,5 @@ +provide-module detect-github %{ + hook global BufCreate .*/CODEOWNERS %{ set-option buffer filetype codeowners } @@ -11,6 +13,10 @@ hook -group codeowners-hightlight global WinSetOption filetype=codeowners %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/codeowners } } +} + +require-module detect-github + provide-module codeowners %{ add-highlighter shared/codeowners regions add-highlighter shared/codeowners/comments region ^# $ group diff --git a/rc/filetype/gjs.kak b/rc/filetype/gjs.kak index 40cdab00e0..2d57d38185 100644 --- a/rc/filetype/gjs.kak +++ b/rc/filetype/gjs.kak @@ -1,6 +1,8 @@ # https://github.com/ember-template-imports/ember-template-imports # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-gjs %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -40,6 +42,10 @@ hook -group gts-highlight global WinSetOption filetype=gts %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gts } } +} + +require-module detect-gjs + # Modules provide-module gjs %{ diff --git a/rc/filetype/gleam.kak b/rc/filetype/gleam.kak index bf52a8f2e3..c95a2eea8e 100644 --- a/rc/filetype/gleam.kak +++ b/rc/filetype/gleam.kak @@ -2,6 +2,8 @@ # # a lot of this file was taken from rc/filetype/go.kak and rc/filetype/hare.kak, thanks everyone ! +provide-module detect-gleam %< + # Detection hook global BufCreate .*\.gleam %{ set-option buffer filetype gleam @@ -32,6 +34,10 @@ hook global WinSetOption filetype=gleam %< ] > +> + +require-module detect-gleam + provide-module gleam %§ # Highlighters add-highlighter shared/gleam regions diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 2c4b96b461..dd1f47b352 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -1,6 +1,8 @@ # http://gluon-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-gluon %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -31,6 +33,10 @@ hook -group gluon-highlight global WinSetOption filetype=gluon %{ } } +} + +require-module detect-gluon + provide-module gluon %§ diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 923eebaa66..efb5ee6660 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -1,6 +1,8 @@ # https://golang.org/ # +provide-module detect-go %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -37,6 +39,10 @@ hook -group go-highlight global WinSetOption filetype=go %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/go } } +} + +require-module detect-go + provide-module go %§ # Highlighters diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index 85bf71de86..8883a23e8b 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -1,6 +1,8 @@ # http://graphql.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-graphql %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group graphql-highlight global WinSetOption filetype=graphql %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/graphql } } +} + +require-module detect-graphql + provide-module graphql %§ diff --git a/rc/filetype/gren.kak b/rc/filetype/gren.kak index d61e59d922..17f37622d5 100644 --- a/rc/filetype/gren.kak +++ b/rc/filetype/gren.kak @@ -1,7 +1,13 @@ # http://gren-lang.org/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-gren %{ + hook global BufCreate .*[.](gren) %{ set-option buffer filetype elm } +} + +require-module detect-gren + diff --git a/rc/filetype/groovy.kak b/rc/filetype/groovy.kak index b6b7305bc0..b8d5db6beb 100644 --- a/rc/filetype/groovy.kak +++ b/rc/filetype/groovy.kak @@ -1,5 +1,7 @@ # Adapted from the file created by Daniel Lewan TeddyDD +provide-module detect-groovy %{ + hook global BufCreate "(.+\.(groovy|gvy|gy|gsh|gradle))|.+[Jj]enkinsfile.*" %{ set-option buffer filetype groovy } @@ -22,6 +24,10 @@ hook -group groovy-highlight global WinSetOption filetype=groovy %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/groovy } } +} + +require-module detect-groovy + provide-module groovy %§ add-highlighter shared/groovy regions diff --git a/rc/filetype/haml.kak b/rc/filetype/haml.kak index 492e78a960..f0c9373c6f 100644 --- a/rc/filetype/haml.kak +++ b/rc/filetype/haml.kak @@ -1,6 +1,8 @@ # http://haml.info # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-haml %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group haml-highlight global WinSetOption filetype=haml %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haml } } +} + +require-module detect-haml + provide-module haml %[ require-module ruby diff --git a/rc/filetype/hare.kak b/rc/filetype/hare.kak index 19c2296462..c16b122688 100644 --- a/rc/filetype/hare.kak +++ b/rc/filetype/hare.kak @@ -1,3 +1,5 @@ +provide-module detect-hare %{ + # detection hook global BufCreate .*[.]ha %{ set-option buffer filetype hare @@ -18,6 +20,10 @@ hook -group hare-highlight global WinSetOption filetype=hare %{ hook -once -always window WinSetOption filetype=*. %{ remove-highlighter window/hare } } +} + +require-module detect-hare + # highlighters provide-module hare %§ add-highlighter shared/hare regions diff --git a/rc/filetype/haskell.kak b/rc/filetype/haskell.kak index 9beed99326..c59ce1ed27 100644 --- a/rc/filetype/haskell.kak +++ b/rc/filetype/haskell.kak @@ -1,6 +1,8 @@ # http://haskell.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-haskell %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group haskell-highlight global WinSetOption filetype=haskell %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haskell } } +} + +require-module detect-haskell + provide-module haskell %[ diff --git a/rc/filetype/hbs.kak b/rc/filetype/hbs.kak index 6b55d9acdc..59bb4e3945 100644 --- a/rc/filetype/hbs.kak +++ b/rc/filetype/hbs.kak @@ -1,6 +1,8 @@ # http://handlebarsjs.com/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-hbs %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group hbs-highlight global WinSetOption filetype=hbs %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hbs-file } } +} + +require-module detect-hbs + provide-module hbs %[ diff --git a/rc/filetype/html.kak b/rc/filetype/html.kak index 0b09ef6a31..bb9a04ae57 100644 --- a/rc/filetype/html.kak +++ b/rc/filetype/html.kak @@ -1,6 +1,8 @@ # http://w3.org/html # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-html %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -34,6 +36,10 @@ hook -group html-highlight global WinSetOption filetype=(html|xml) %{ " } +} + +require-module detect-html + provide-module html %[ diff --git a/rc/filetype/i3.kak b/rc/filetype/i3.kak index deafb6c3e4..8bae07723a 100644 --- a/rc/filetype/i3.kak +++ b/rc/filetype/i3.kak @@ -1,3 +1,5 @@ +provide-module detect-i3 %[ + hook global BufCreate .*(sway|i3)/config %{ set buffer filetype i3 } @@ -22,6 +24,10 @@ hook -group i3-highlight global WinSetOption filetype=i3 %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/i3 } } +] + +require-module detect-i3 + provide-module i3 %[ diff --git a/rc/filetype/ini.kak b/rc/filetype/ini.kak index 75762f6af6..feaba9075d 100644 --- a/rc/filetype/ini.kak +++ b/rc/filetype/ini.kak @@ -1,3 +1,5 @@ +provide-module detect-ini %{ + hook global BufCreate .+\.ini %{ set-option buffer filetype ini } @@ -11,6 +13,10 @@ hook -group ini-highlight global WinSetOption filetype=ini %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini } } +} + +require-module detect-ini + provide-module ini %{ diff --git a/rc/filetype/janet.kak b/rc/filetype/janet.kak index 00f39c278d..0bee206c62 100644 --- a/rc/filetype/janet.kak +++ b/rc/filetype/janet.kak @@ -1,6 +1,8 @@ # http://janet-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-janet %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -24,6 +26,10 @@ hook -group janet-highlight global WinSetOption filetype=janet %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/janet } } +} + +require-module detect-janet + provide-module janet %{ require-module lisp diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index 69b0d74ebc..60fa2c29f4 100644 --- a/rc/filetype/java.kak +++ b/rc/filetype/java.kak @@ -1,3 +1,5 @@ +provide-module detect-java %{ + hook global BufCreate .*\.java %{ set-option buffer filetype java } @@ -25,6 +27,10 @@ hook -group java-highlight global WinSetOption filetype=java %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/java } } +} + +require-module detect-java + provide-module java %§ add-highlighter shared/java regions diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 05e0bc6a6e..7cb35ef059 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -1,3 +1,5 @@ +provide-module detect-javascript %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -35,6 +37,10 @@ hook -group typescript-highlight global WinSetOption filetype=typescript %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/typescript } } +} + +require-module detect-javascript + provide-module javascript %§ diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 8ca7c2a31b..f0eaad6507 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -1,6 +1,8 @@ # http://json.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-json %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group json-highlight global WinSetOption filetype=json %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/json } } +} + +require-module detect-json + provide-module json %( diff --git a/rc/filetype/julia.kak b/rc/filetype/julia.kak index 6dc2af13e2..490ce11e41 100644 --- a/rc/filetype/julia.kak +++ b/rc/filetype/julia.kak @@ -1,6 +1,8 @@ # http://julialang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-julia %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -23,6 +25,10 @@ hook -group julia-highlight global WinSetOption filetype=julia %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia } } +} + +require-module detect-julia + provide-module julia %§ diff --git a/rc/filetype/just.kak b/rc/filetype/just.kak index 8c43fcc11b..95f949f487 100644 --- a/rc/filetype/just.kak +++ b/rc/filetype/just.kak @@ -1,3 +1,5 @@ +provide-module detect-just %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -19,6 +21,10 @@ hook -group justfile-highlight global WinSetOption filetype=justfile %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/justfile } } +} + +require-module detect-just + provide-module justfile %{ diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 1914e4645b..cefe3913b8 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -1,6 +1,8 @@ # http://kakoune.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-kakrc %§ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -32,6 +34,10 @@ hook -group kak-highlight global WinSetOption filetype=kak %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kakrc } } +§ + +require-module detect-kakrc + provide-module kak %§ require-module sh diff --git a/rc/filetype/kickstart.kak b/rc/filetype/kickstart.kak index 0e7441b1e1..1585265a4a 100644 --- a/rc/filetype/kickstart.kak +++ b/rc/filetype/kickstart.kak @@ -1,3 +1,5 @@ +provide-module detect-kickstart %{ + hook global BufCreate .*\.ks %{ set-option buffer filetype kickstart } @@ -11,6 +13,10 @@ hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart } } +} + +require-module detect-kickstart + provide-module kickstart %{ diff --git a/rc/filetype/kotlin.kak b/rc/filetype/kotlin.kak index d1707a8e5a..e97b7854d4 100644 --- a/rc/filetype/kotlin.kak +++ b/rc/filetype/kotlin.kak @@ -6,6 +6,8 @@ # Kdoc 2020, Documenting Kotlin Code, Block Tags, v1.4.0, viewed 9 September 2020, https://kotlinlang.org/docs/reference/kotlin-doc.html # Oracle 2020, Java Platform, Standard Edition & Java Development Kit, Version 14 API Specification, viewed 8 September 2020, https://docs.oracle.com/en/java/javase/14/docs/api/index.html # +provide-module detect-kotlin %{ + # File types --------------------------------------------------------------------------------------- # # ‾‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](kt|kts) %{ @@ -49,6 +51,10 @@ hook global BufSetOption filetype=kotlin %{ hook -once -always buffer BufSetOption filetype=.* %{ remove-hooks buffer kotlin-.+ } } +} + +require-module detect-kotlin + # Module ------------------------------------------------------------------------------------------- # # ‾‾‾‾‾‾ provide-module kotlin %§ diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index 7cc63c46e2..c2b10ddfd0 100644 --- a/rc/filetype/latex.kak +++ b/rc/filetype/latex.kak @@ -1,6 +1,8 @@ # https://www.latex-project.org/ # +provide-module detect-latex %( + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group latex-highlight global WinSetOption filetype=latex %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/latex } } +) + +require-module detect-latex + provide-module latex %~ # Highlighters diff --git a/rc/filetype/ledger.kak b/rc/filetype/ledger.kak index 31417b789e..1019d3402e 100644 --- a/rc/filetype/ledger.kak +++ b/rc/filetype/ledger.kak @@ -1,3 +1,5 @@ +provide-module detect-ledger %{ + # Detection # --------- @@ -37,6 +39,10 @@ hook -group ledger-complete global WinSetOption filetype=ledger %{ define end include tag test year } +} + +require-module detect-ledger + provide-module ledger %[ # Highlighters diff --git a/rc/filetype/lisp.kak b/rc/filetype/lisp.kak index d018e78331..21577b992a 100644 --- a/rc/filetype/lisp.kak +++ b/rc/filetype/lisp.kak @@ -1,6 +1,8 @@ # http://common-lisp.net # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-lisp %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group lisp-highlight global WinSetOption filetype=lisp %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lisp } } +} + +require-module detect-lisp + provide-module lisp %{ # Highlighters diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak index 070ac00584..6254833a5f 100644 --- a/rc/filetype/lua.kak +++ b/rc/filetype/lua.kak @@ -1,6 +1,8 @@ # http://lua.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-lua %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -32,6 +34,10 @@ hook -group lua-highlight global WinSetOption filetype=lua %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua } } +} + +require-module detect-lua + provide-module lua %§ diff --git a/rc/filetype/makefile.kak b/rc/filetype/makefile.kak index c668d69699..bbc71f24d1 100644 --- a/rc/filetype/makefile.kak +++ b/rc/filetype/makefile.kak @@ -1,3 +1,5 @@ +provide-module detect-makefile %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -23,6 +25,10 @@ hook -group makefile-highlight global WinSetOption filetype=makefile %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/makefile } } +} + +require-module detect-makefile + provide-module makefile %{ # Highlighters diff --git a/rc/filetype/markdown.kak b/rc/filetype/markdown.kak index 0a08bdc9a5..c03b579ae5 100644 --- a/rc/filetype/markdown.kak +++ b/rc/filetype/markdown.kak @@ -1,6 +1,8 @@ # http://daringfireball.net/projects/markdown # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-markdown %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -35,6 +37,10 @@ hook -group markdown-highlight global WinSetOption filetype=markdown %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown } } +} + +require-module detect-markdown + provide-module markdown %{ diff --git a/rc/filetype/mercurial.kak b/rc/filetype/mercurial.kak index 255b02be12..254997fe46 100644 --- a/rc/filetype/mercurial.kak +++ b/rc/filetype/mercurial.kak @@ -1,6 +1,8 @@ # https://www.mercurial-scm.org/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-mercurial %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -17,6 +19,10 @@ hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight } } +} + +require-module detect-mercurial + provide-module hg-commit %{ # Faces diff --git a/rc/filetype/mercury.kak b/rc/filetype/mercury.kak index 813b4ca04c..d3691038cd 100644 --- a/rc/filetype/mercury.kak +++ b/rc/filetype/mercury.kak @@ -1,3 +1,5 @@ +provide-module detect-mercury %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -25,6 +27,10 @@ hook -group mercury-highlight global WinSetOption filetype=mercury %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mercury } } +} + +require-module detect-mercury + provide-module mercury %§ diff --git a/rc/filetype/meson.kak b/rc/filetype/meson.kak index 362af32505..91e7c4b9b3 100644 --- a/rc/filetype/meson.kak +++ b/rc/filetype/meson.kak @@ -4,6 +4,8 @@ # https://mesonbuild.com/Syntax.html # https://github.com/mesonbuild/meson/blob/master/data/syntax-highlighting/vim/syntax/meson.vim +provide-module detect-meson %{ + ## Detection hook global BufCreate (.*/|^)(meson\.build|meson_options\.txt) %{ @@ -21,6 +23,10 @@ hook -group meson-highlight global WinSetOption filetype=meson %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/meson } } +} + +require-module detect-meson + provide-module meson %§ ## Highlighters diff --git a/rc/filetype/mlb.kak b/rc/filetype/mlb.kak index aa17423416..f05793c3f2 100644 --- a/rc/filetype/mlb.kak +++ b/rc/filetype/mlb.kak @@ -1,6 +1,8 @@ # http://mlton.org/MLBasis # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-mlb %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -22,6 +24,10 @@ hook -group mlb-highlight global WinSetOption filetype=mlb %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mlb } } +} + +require-module detect-mlb + provide-module mlb %[ # Highlighters diff --git a/rc/filetype/moon.kak b/rc/filetype/moon.kak index 08b1786514..9e1702dd30 100644 --- a/rc/filetype/moon.kak +++ b/rc/filetype/moon.kak @@ -1,6 +1,8 @@ # http://moonscript.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-moon %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -32,6 +34,10 @@ hook -group moon-highlight global WinSetOption filetype=moon %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/moon } } +} + +require-module detect-moon + provide-module moon %[ diff --git a/rc/filetype/nim.kak b/rc/filetype/nim.kak index 2c00ac39d5..51458a928b 100644 --- a/rc/filetype/nim.kak +++ b/rc/filetype/nim.kak @@ -1,6 +1,8 @@ # https://nim-lang.org/ # +provide-module detect-nim %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group nim-highlight global WinSetOption filetype=nim %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/nim } } +} + +require-module detect-nim + provide-module nim %{ # Highlighters diff --git a/rc/filetype/ninja.kak b/rc/filetype/ninja.kak index 757b7ad279..1da689cbb8 100644 --- a/rc/filetype/ninja.kak +++ b/rc/filetype/ninja.kak @@ -1,5 +1,7 @@ # ref: https://ninja-build.org/manual.html#ref_ninja_file +provide-module detect-ninja %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -30,6 +32,10 @@ hook -group ninja-highlight global WinSetOption filetype=ninja %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ninja } } +} + +require-module detect-ninja + provide-module ninja %{ diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 35e5e4ebf2..2b373d5abe 100644 --- a/rc/filetype/nix.kak +++ b/rc/filetype/nix.kak @@ -1,6 +1,8 @@ # Nix package manager language # https://nixos.org/nix/manual/ +provide-module detect-nix %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group nix-highlight global WinSetOption filetype=nix %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/nix } } +} + +require-module detect-nix + provide-module nix %§ # Highlighters diff --git a/rc/filetype/ocaml.kak b/rc/filetype/ocaml.kak index 06a1bf5d69..b78238a808 100644 --- a/rc/filetype/ocaml.kak +++ b/rc/filetype/ocaml.kak @@ -1,6 +1,8 @@ # http://ocaml.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-ocaml %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group ocaml-highlight global WinSetOption filetype=ocaml %{ } } +} + +require-module detect-ocaml + provide-module ocaml %{ # Highlighters diff --git a/rc/filetype/odin.kak b/rc/filetype/odin.kak index 4f43deab7f..7663cda89b 100644 --- a/rc/filetype/odin.kak +++ b/rc/filetype/odin.kak @@ -1,3 +1,5 @@ +provide-module detect-odin %{ + hook global BufCreate .*\.odin %{ set-option buffer filetype odin } @@ -25,6 +27,10 @@ hook -group odin-highlight global WinSetOption filetype=odin %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/odin } } +} + +require-module detect-odin + provide-module odin %§ add-highlighter shared/odin regions diff --git a/rc/filetype/pascal.kak b/rc/filetype/pascal.kak index eae457729d..2737db98a7 100644 --- a/rc/filetype/pascal.kak +++ b/rc/filetype/pascal.kak @@ -1,7 +1,10 @@ # https://www.freepascal.org/docs-html/ref/ref.html # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-pascal %[ + # Detection, see https://wiki.freepascal.org/file_types + hook global BufCreate .*\.(p|pp|pas|pascal)$ %{ set-option buffer filetype pascal } @@ -25,6 +28,10 @@ hook -group pascal-highlight global WinSetOption filetype=((free|object)?pascal| hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/pascal } ] +] + +require-module detect-pascal + provide-module pascal %§ add-highlighter shared/pascal regions diff --git a/rc/filetype/perf.kak b/rc/filetype/perf.kak index 55a77323d3..5ed0130a96 100644 --- a/rc/filetype/perf.kak +++ b/rc/filetype/perf.kak @@ -9,6 +9,8 @@ provide-module perf-report %{ } } +provide-module detect-perf-report %{ + hook -group perf-report-highlight global WinSetOption filetype=perf-report %{ require-module perf-report add-highlighter window/perf-report ref perf-report @@ -17,6 +19,10 @@ hook -group perf-report-highlight global WinSetOption filetype=perf-report %{ map window normal ': perf-report-focus' } +} + +require-module detect-perf-report + provide-module perf-annotate %{ require-module gas add-highlighter shared/perf-annotate group @@ -25,8 +31,14 @@ provide-module perf-annotate %{ add-highlighter shared/perf-annotate/below_threshold regex '^\h+0\.\d+\b' 0:green } +provide-module detect-perf-annotate %{ + hook -group perf-annotate-highlight global WinSetOption filetype=perf-annotate %{ require-module perf-annotate add-highlighter window/perf-annotate ref perf-annotate hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perf-annotate } } + +} + +require-module detect-perf-annotate diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index 2fcb02658c..4e36ba01b9 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -1,6 +1,8 @@ # https://www.perl.org/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-perl %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -31,6 +33,10 @@ hook -group perl-highlight global WinSetOption filetype=perl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perl } } +} + +require-module detect-perl + provide-module perl %§ # Highlighters diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 98da9e0285..21561fd66e 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -1,3 +1,5 @@ +provide-module detect-php %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -24,6 +26,10 @@ hook -group php-highlight global WinSetOption filetype=php %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/php-file } } +} + +require-module detect-php + provide-module php %§ require-module html diff --git a/rc/filetype/pony.kak b/rc/filetype/pony.kak index 6a91688bef..792e6a4659 100644 --- a/rc/filetype/pony.kak +++ b/rc/filetype/pony.kak @@ -1,6 +1,8 @@ # http://ponylang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-pony %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -31,6 +33,10 @@ hook -group pony-highlight global WinSetOption filetype=pony %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter pony } } +} + +require-module detect-pony + provide-module pony %§ # Highlighters & Completion diff --git a/rc/filetype/prolog.kak b/rc/filetype/prolog.kak index e9de523f61..d53254ecbd 100644 --- a/rc/filetype/prolog.kak +++ b/rc/filetype/prolog.kak @@ -3,8 +3,11 @@ # Adapted from rc/filetype/erlang.kak +provide-module detect-prolog %{ + # Detection # ‾‾‾‾‾‾‾‾‾ + hook global BufCreate .*[.](pl|P) %{ set-option buffer filetype prolog } @@ -22,6 +25,10 @@ hook -group prolog-highlight global WinSetOption filetype=prolog %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/prolog } } +} + +require-module detect-prolog + provide-module prolog %[ # Highlighters diff --git a/rc/filetype/protobuf.kak b/rc/filetype/protobuf.kak index b85295e191..f36a9ebf22 100644 --- a/rc/filetype/protobuf.kak +++ b/rc/filetype/protobuf.kak @@ -1,5 +1,7 @@ # https://developers.google.com/protocol-buffers/ +provide-module detect-protobuff %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group protobuf-highlight global WinSetOption filetype=protobuf %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/protobuf } } +] + +require-module detect-protobuff + provide-module protobuf %[ # Highlighters diff --git a/rc/filetype/prql.kak b/rc/filetype/prql.kak index 54b3c7bb99..ca97a35872 100644 --- a/rc/filetype/prql.kak +++ b/rc/filetype/prql.kak @@ -1,6 +1,8 @@ # https://prql-lang.org/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-prql %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group prql-highlight global WinSetOption filetype=prql %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/prql } } +} + +require-module detect-prql + provide-module prql %§ # Highlighters & Completion diff --git a/rc/filetype/pug.kak b/rc/filetype/pug.kak index db05c9bc1d..231acee868 100644 --- a/rc/filetype/pug.kak +++ b/rc/filetype/pug.kak @@ -5,6 +5,8 @@ # http://jade-lang.com (will be http://pug-lang.com) # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-pug %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group pug-highlight global WinSetOption filetype=pug %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/pug } } +} + +require-module detect-pug + provide-module pug %{ diff --git a/rc/filetype/purescript.kak b/rc/filetype/purescript.kak index 8945ae608a..16edd0f34c 100644 --- a/rc/filetype/purescript.kak +++ b/rc/filetype/purescript.kak @@ -3,6 +3,8 @@ # Syntax reference # https://github.com/purescript/documentation/blob/master/language/Syntax.md +provide-module detect-purescript %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group purescript-highlight global WinSetOption filetype=purescript %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/purescript } } +} + +require-module detect-purescript + provide-module purescript %§ diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 5f42a7de46..396f10deb2 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -1,6 +1,8 @@ # http://python.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-python %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group python-highlight global WinSetOption filetype=python %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python } } +} + +require-module detect-python + provide-module python %§ # Highlighters & Completion diff --git a/rc/filetype/r.kak b/rc/filetype/r.kak index d3d98547e7..746fbba24e 100644 --- a/rc/filetype/r.kak +++ b/rc/filetype/r.kak @@ -1,6 +1,8 @@ # http://kakoune.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-r %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -8,6 +10,10 @@ hook global BufCreate (.*/)?(\.Rprofile|.*\.[rR]) %{ set-option buffer filetype r } +} + +require-module detect-r + provide-module r %§ # Highlighters & Completion diff --git a/rc/filetype/ragel.kak b/rc/filetype/ragel.kak index e0a77db2ec..477a77df50 100644 --- a/rc/filetype/ragel.kak +++ b/rc/filetype/ragel.kak @@ -3,6 +3,8 @@ # ragel.kak does not try to detect host language. +provide-module detect-ragel %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group ragel-highlight global WinSetOption filetype=ragel %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ragel } } +} + +require-module detect-ragel + provide-module ragel %§ # Highlighters diff --git a/rc/filetype/restructuredtext.kak b/rc/filetype/restructuredtext.kak index 7853b301a2..3f700d275a 100644 --- a/rc/filetype/restructuredtext.kak +++ b/rc/filetype/restructuredtext.kak @@ -1,3 +1,5 @@ +provide-module detect-restructuredtext %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group restructuredtext-highlight global WinSetOption filetype=restructured hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext } } +} + +require-module detect-restructuredtext + provide-module restructuredtext %{ # Highlighters diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 0a57264a25..aefc0b1a9e 100644 --- a/rc/filetype/ruby.kak +++ b/rc/filetype/ruby.kak @@ -1,6 +1,8 @@ # http://ruby-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-ruby %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -34,6 +36,10 @@ hook -group ruby-highlight global WinSetOption filetype=ruby %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ruby } } +} + +require-module detect-ruby + provide-module ruby %§ # Highlighters diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index e1906c45cf..102c05f384 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -1,6 +1,8 @@ # http://rust-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-rust %< + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -25,6 +27,10 @@ hook -group rust-highlight global WinSetOption filetype=rust %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/rust } } +> + +require-module detect-rust + provide-module rust %§ # Highlighters diff --git a/rc/filetype/sass.kak b/rc/filetype/sass.kak index 5f2cce0867..0111e2726a 100644 --- a/rc/filetype/sass.kak +++ b/rc/filetype/sass.kak @@ -1,6 +1,8 @@ # http://sass-lang.com # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-sass %< + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group sass-highlight global WinSetOption filetype=sass %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sass } } +> + +require-module detect-sass + provide-module sass %§ diff --git a/rc/filetype/scala.kak b/rc/filetype/scala.kak index 05d7b28ee5..4f0ad0fe3f 100644 --- a/rc/filetype/scala.kak +++ b/rc/filetype/scala.kak @@ -1,6 +1,8 @@ # http://scala-lang.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-scala %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group scala-highlight global WinSetOption filetype=scala %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scala } } +] + +require-module detect-scala + provide-module scala %[ diff --git a/rc/filetype/scheme.kak b/rc/filetype/scheme.kak index 5e2e97cce0..0729fabe7f 100644 --- a/rc/filetype/scheme.kak +++ b/rc/filetype/scheme.kak @@ -1,6 +1,8 @@ # http://www.scheme-reports.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-scheme %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group scheme-highlight global WinSetOption filetype=scheme %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scheme } } +} + +require-module detect-scheme + provide-module scheme %{ require-module lisp diff --git a/rc/filetype/scss.kak b/rc/filetype/scss.kak index a4ac7b073f..6e54654e44 100644 --- a/rc/filetype/scss.kak +++ b/rc/filetype/scss.kak @@ -1,6 +1,8 @@ # http://sass-lang.com # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-scss %[ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -28,6 +30,10 @@ hook -group scss-highlight global WinSetOption filetype=scss %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scss } } +] + +require-module detect-scss + provide-module scss %[ diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 5f9a50c77c..02a95a8b8d 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -1,3 +1,5 @@ +provide-module detect-sh %{ + hook global BufCreate .*\.((z|ba|c|k|mk)?(sh(rc|_profile|env)?|profile)) %{ set-option buffer filetype sh } @@ -17,6 +19,10 @@ hook -group sh-highlight global WinSetOption filetype=sh %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sh } } +} + +require-module detect-sh + # using non-ascii characters here so that we can use the '[' command provide-module sh %§ diff --git a/rc/filetype/sml.kak b/rc/filetype/sml.kak index 830c56072f..3c9965205e 100644 --- a/rc/filetype/sml.kak +++ b/rc/filetype/sml.kak @@ -1,11 +1,11 @@ # https://smlfamily.github.io # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-sml %{ + # Detection # ‾‾‾‾‾‾‾‾‾ -provide-module detect-sml %{ - hook global BufCreate .*\.(sml|fun|sig) %{ set-option buffer filetype sml } diff --git a/rc/filetype/sql.kak b/rc/filetype/sql.kak index e60aeadde1..963b77b8a4 100644 --- a/rc/filetype/sql.kak +++ b/rc/filetype/sql.kak @@ -1,6 +1,8 @@ # https://www.w3schools.com/sql/default.asp # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-sql %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -21,6 +23,10 @@ hook -group sql-highlight global WinSetOption filetype=sql %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sql } } +} + +require-module detect-sql + provide-module sql %{ diff --git a/rc/filetype/svelte.kak b/rc/filetype/svelte.kak index a4469f29f5..51b10c3922 100644 --- a/rc/filetype/svelte.kak +++ b/rc/filetype/svelte.kak @@ -1,3 +1,5 @@ +provide-module detect-svelte %{ + hook global BufCreate .*\.svelte %[ set-option buffer filetype svelte ] @@ -21,6 +23,10 @@ hook -group svelte-highlight global WinSetOption filetype=(svelte) %{ " } +} + +require-module detect-svelte + add-highlighter shared/svelte regions add-highlighter shared/svelte/comment region fill comment add-highlighter shared/svelte/tag region < > regions diff --git a/rc/filetype/swift.kak b/rc/filetype/swift.kak index 10c2b77132..c96c09d0e7 100644 --- a/rc/filetype/swift.kak +++ b/rc/filetype/swift.kak @@ -1,3 +1,5 @@ +provide-module detect-swift %{ + hook global BufCreate .*\.(swift) %{ set-option buffer filetype swift } @@ -11,6 +13,10 @@ hook -group swift-highlight global WinSetOption filetype=swift %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift } } +} + +require-module detect-swift + provide-module swift %{ diff --git a/rc/filetype/systemd.kak b/rc/filetype/systemd.kak index 3810d00514..36880d2950 100644 --- a/rc/filetype/systemd.kak +++ b/rc/filetype/systemd.kak @@ -1,6 +1,8 @@ # https://freedesktop.org/wiki/Software/systemd/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-systemd %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -12,3 +14,7 @@ hook global BufCreate .*/systemd/.+\.(automount|conf|link|mount|network|path|ser set-option buffer comment_line "#" } } + +} + +require-module detect-systemd diff --git a/rc/filetype/taskpaper.kak b/rc/filetype/taskpaper.kak index 187aa09c89..8ee4a382d3 100644 --- a/rc/filetype/taskpaper.kak +++ b/rc/filetype/taskpaper.kak @@ -1,6 +1,8 @@ # https://www.taskpaper.com # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-taskpaper %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -24,6 +26,10 @@ hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper } } +} + +require-module detect-taskpaper + provide-module taskpaper %{ diff --git a/rc/filetype/tcl.kak b/rc/filetype/tcl.kak index 7a4b651984..92c12ff8c4 100644 --- a/rc/filetype/tcl.kak +++ b/rc/filetype/tcl.kak @@ -1,3 +1,5 @@ +provide-module detect-tcl %{ + hook global BufCreate .*[.](tcl) %{ set-option buffer filetype tcl } @@ -16,6 +18,10 @@ hook -group tcl-highlight global WinSetOption filetype=tcl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tcl } } +} + +require-module detect-tcl + # Using non-ascii characters here so that we can use the '[' command provide-module tcl %§ diff --git a/rc/filetype/terraform.kak b/rc/filetype/terraform.kak index 3ad975a7b8..9a6db71a9a 100644 --- a/rc/filetype/terraform.kak +++ b/rc/filetype/terraform.kak @@ -1,6 +1,8 @@ # Terraform configuration language # https://www.terraform.io/docs/configuration/ +provide-module detect-terraform %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group terraform-highlight global WinSetOption filetype=terraform %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/terraform } } +} + +require-module detect-terraform + provide-module terraform %§ diff --git a/rc/filetype/toml.kak b/rc/filetype/toml.kak index d02e074069..48a128d5ab 100644 --- a/rc/filetype/toml.kak +++ b/rc/filetype/toml.kak @@ -1,6 +1,8 @@ # https://github.com/toml-lang/toml/tree/v0.4.0 # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-toml %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -26,6 +28,10 @@ hook -group toml-highlight global WinSetOption filetype=toml %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/toml } } +} + +require-module detect-toml + provide-module toml %{ diff --git a/rc/filetype/troff.kak b/rc/filetype/troff.kak index 205c288118..75ec3bb059 100644 --- a/rc/filetype/troff.kak +++ b/rc/filetype/troff.kak @@ -1,3 +1,5 @@ +provide-module detect-troff %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -17,6 +19,10 @@ hook -group troff-highlight global WinSetOption filetype=troff %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/troff } } +} + +require-module detect-troff + provide-module troff %{ # Highlighters diff --git a/rc/filetype/ttl.kak b/rc/filetype/ttl.kak index cab3f61637..0cb093e6de 100644 --- a/rc/filetype/ttl.kak +++ b/rc/filetype/ttl.kak @@ -2,6 +2,8 @@ # of the W3C's Resource Description Framework (RDF): # https://www.w3.org/TR/turtle/ +provide-module detect-ttl %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,6 +29,10 @@ hook -group ttl-highlight global WinSetOption filetype=ttl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ttl } } +} + +require-module detect-ttl + provide-module ttl %{ diff --git a/rc/filetype/tupfile.kak b/rc/filetype/tupfile.kak index 33e570d656..f39b1502a6 100644 --- a/rc/filetype/tupfile.kak +++ b/rc/filetype/tupfile.kak @@ -1,6 +1,8 @@ # http://gittup.org/tup/ # +provide-module detect-tupfile %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -18,6 +20,10 @@ hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile } } +} + +require-module detect-tupfile + provide-module tupfile %{ diff --git a/rc/filetype/twig.kak b/rc/filetype/twig.kak index 2f5ef18446..9c43cf9a9a 100644 --- a/rc/filetype/twig.kak +++ b/rc/filetype/twig.kak @@ -1,6 +1,8 @@ # https://twig.symfony.com/doc/3.x/templates.html # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-twig %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -30,6 +32,10 @@ hook -group twig-highlight global WinSetOption filetype=twig %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/twig } } +} + +require-module detect-twig + provide-module twig %[ diff --git a/rc/filetype/typst.kak b/rc/filetype/typst.kak index 5353ea6a6b..ed48f0999b 100644 --- a/rc/filetype/typst.kak +++ b/rc/filetype/typst.kak @@ -1,3 +1,5 @@ +provide-module detect-typst %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -16,6 +18,10 @@ hook -group typst-highlight global WinSetOption filetype=typst %{ hook window InsertChar \n -group typst typst-on-new-line } +} + +require-module detect-typst + provide-module typst %§ # Highlighters diff --git a/rc/filetype/vhdl.kak b/rc/filetype/vhdl.kak index 71aa7ed851..e4eb5fa222 100644 --- a/rc/filetype/vhdl.kak +++ b/rc/filetype/vhdl.kak @@ -1,5 +1,7 @@ # Based on IEEE Std 1076‐2019 +provide-module detect-vhdl %[ + # Detection hook global BufCreate .*[.](vhd[l]?) %[ set-option buffer filetype vhdl @@ -22,6 +24,10 @@ hook -group vhdl-highlight global WinSetOption filetype=vhdl %[ hook -once -always window WinSetOption filetype=.* %[ remove-highlighter window/vhdl ] ] +] + +require-module detect-vhdl + provide-module vhdl %§ # Highlighters & Completion diff --git a/rc/filetype/void-linux.kak b/rc/filetype/void-linux.kak index 23a0206126..28d4dc9c50 100644 --- a/rc/filetype/void-linux.kak +++ b/rc/filetype/void-linux.kak @@ -1,4 +1,11 @@ # Void Linux package template + +provide-module detect-void-linux %{ + hook global BufCreate .*/?srcpkgs/.+/template %{ set-option buffer filetype sh } + +} + +require-module detect-void-linux diff --git a/rc/filetype/wren.kak b/rc/filetype/wren.kak index 413cc556a4..e5d95c0cf8 100644 --- a/rc/filetype/wren.kak +++ b/rc/filetype/wren.kak @@ -60,6 +60,8 @@ provide-module -override wren %§ 'var' 'while' 'Bool' 'Class' 'Fiber' 'Fn' 'List' 'Map' 'Null' 'Num' 'Object' 'Range' 'Sequence' 'String' 'System' § +provide-module detect-wren %{ + hook global BufCreate (.*/)?.*\.wren %{ set-option buffer filetype wren } hook -group wren-highlight global WinSetOption filetype=wren %{ @@ -83,6 +85,10 @@ hook global WinSetOption filetype=wren %{ hook window InsertChar \n -group wren-closing-delimiter-insert wren-insert-closing-delimiter-on-new-line } +} + +require-module detect-wren + define-command -hidden wren-indent-on-new-line %~ evaluate-commands -draft -itersel %= # preserve previous line indent diff --git a/rc/filetype/yaml.kak b/rc/filetype/yaml.kak index db6a4f90d5..cf203f3ea8 100644 --- a/rc/filetype/yaml.kak +++ b/rc/filetype/yaml.kak @@ -1,6 +1,8 @@ # http://yaml.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ +provide-module detect-yaml %{ + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -25,6 +27,10 @@ hook -group yaml-highlight global WinSetOption filetype=yaml %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/yaml } } +} + +require-module detect-yaml + provide-module yaml %{ diff --git a/rc/filetype/zig.kak b/rc/filetype/zig.kak index cdd06a9095..1121964283 100644 --- a/rc/filetype/zig.kak +++ b/rc/filetype/zig.kak @@ -3,6 +3,8 @@ # based off of https://github.com/ziglang/zig.vim/blob/master/syntax/zig.vim # as well as https://ziglang.org/documentation/master/#Grammar +provide-module detect-zig %< + # Detection # ‾‾‾‾‾‾‾‾‾ @@ -29,6 +31,10 @@ hook -group zig-highlight global WinSetOption filetype=zig %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/zig } } +> + +require-module detect-zig + provide-module zig %§ # Highlighters From fc339de22c314b9b90b4ea9443b85cd0122fdab3 Mon Sep 17 00:00:00 2001 From: pascal Date: Sun, 10 Aug 2025 11:46:21 +0100 Subject: [PATCH 6/7] angle bracket expansion for detect-apl --- rc/filetype/apl.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/apl.kak b/rc/filetype/apl.kak index 204b1791db..9b4de63649 100644 --- a/rc/filetype/apl.kak +++ b/rc/filetype/apl.kak @@ -1,4 +1,4 @@ -provide-module detect-apl %@ +provide-module detect-apl %< # Detection # ‾‾‾‾‾‾‾‾‾ @@ -27,7 +27,7 @@ hook -group apl-highlight global WinSetOption filetype=apl %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/apl } } -@ +> require-module detect-apl From 27d5949d63505f5462d94225562a008c7de53c8d Mon Sep 17 00:00:00 2001 From: pascal Date: Sun, 10 Aug 2025 12:29:19 +0100 Subject: [PATCH 7/7] more consistent detect-filetype useage --- rc/filetype/exherbo.kak | 73 +++++++++++++++++++++++------------------ rc/filetype/perf.kak | 45 +++++++++++-------------- rc/filetype/r.kak | 40 +++++++++++----------- 3 files changed, 81 insertions(+), 77 deletions(-) diff --git a/rc/filetype/exherbo.kak b/rc/filetype/exherbo.kak index 94cd76de4d..0dab84144a 100644 --- a/rc/filetype/exherbo.kak +++ b/rc/filetype/exherbo.kak @@ -1,5 +1,7 @@ provide-module detect-exherbo %{ +# exheres + ## Repository metadata files hook global BufCreate .*/metadata/mirrors\.conf %{ set-option buffer filetype paludis-mirrors-conf } hook global BufCreate .*/metadata/licence_groups.conf %{ set-option buffer filetype exheres-0-licence-groups } @@ -46,6 +48,45 @@ hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exhe hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups } } + +# paludis + +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 } +} + + +# glep42 + +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 } +} + } require-module detect-exherbo @@ -74,29 +115,6 @@ add-highlighter shared/exheres-0-licence-groups/ regex ^(\S+) 0:type add-highlighter shared/exheres-0-licence-groups/ regex ^#.*?$ 0:comment } -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 @@ -126,15 +144,6 @@ add-highlighter shared/paludis-specs-conf/ regex ^(\S+/\S+) 0:type add-highlighter shared/paludis-specs-conf/ regex ^#.*?$ 0:comment } -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 %{ ## News items (GLEP42) add-highlighter shared/glep42 group diff --git a/rc/filetype/perf.kak b/rc/filetype/perf.kak index 5ed0130a96..a99d107e01 100644 --- a/rc/filetype/perf.kak +++ b/rc/filetype/perf.kak @@ -1,15 +1,4 @@ -provide-module perf-report %{ - add-highlighter shared/perf-report group - add-highlighter shared/perf-report/above_threshold regex '\b([5-9]|\d{2})\.\d+%' 0:red - add-highlighter shared/perf-report/below_threshold regex '\b[0-4]\.\d+%' 0:green - - - define-command -override perf-report-focus %{ - execute-keys 'xs...\d+\.\d+%vtv' - } -} - -provide-module detect-perf-report %{ +provide-module detect-perf %{ hook -group perf-report-highlight global WinSetOption filetype=perf-report %{ require-module perf-report @@ -19,9 +8,27 @@ hook -group perf-report-highlight global WinSetOption filetype=perf-report %{ map window normal ': perf-report-focus' } +hook -group perf-annotate-highlight global WinSetOption filetype=perf-annotate %{ + require-module perf-annotate + add-highlighter window/perf-annotate ref perf-annotate + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perf-annotate } +} + } -require-module detect-perf-report +require-module detect-perf + + +provide-module perf-report %{ + add-highlighter shared/perf-report group + add-highlighter shared/perf-report/above_threshold regex '\b([5-9]|\d{2})\.\d+%' 0:red + add-highlighter shared/perf-report/below_threshold regex '\b[0-4]\.\d+%' 0:green + + + define-command -override perf-report-focus %{ + execute-keys 'xs...\d+\.\d+%vtv' + } +} provide-module perf-annotate %{ require-module gas @@ -30,15 +37,3 @@ provide-module perf-annotate %{ add-highlighter shared/perf-annotate/above_threshold regex '^\h+([1-9]|\d{2})\.\d+\b' 0:red add-highlighter shared/perf-annotate/below_threshold regex '^\h+0\.\d+\b' 0:green } - -provide-module detect-perf-annotate %{ - -hook -group perf-annotate-highlight global WinSetOption filetype=perf-annotate %{ - require-module perf-annotate - add-highlighter window/perf-annotate ref perf-annotate - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perf-annotate } -} - -} - -require-module detect-perf-annotate diff --git a/rc/filetype/r.kak b/rc/filetype/r.kak index 746fbba24e..06530d2a17 100644 --- a/rc/filetype/r.kak +++ b/rc/filetype/r.kak @@ -10,6 +10,26 @@ hook global BufCreate (.*/)?(\.Rprofile|.*\.[rR]) %{ set-option buffer filetype r } +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook -group r-highlight global WinSetOption filetype=r %{ + require-module r + add-highlighter window/r ref r + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/r } +} + +hook global WinSetOption filetype=r %~ + require-module r + hook window ModeChange pop:insert:.* r-trim-indent + hook window InsertChar \n r-insert-on-newline + hook window InsertChar \n r-indent-on-newline + hook window InsertChar \{ r-indent-on-opening-curly-brace + hook window InsertChar \} r-indent-on-closing-curly-brace + + hook -once -always window WinSetOption filetype=.* %{ remove-hooks window r-.+ } +~ + } require-module detect-r @@ -139,23 +159,3 @@ define-command -hidden r-insert-on-newline %[ evaluate-commands -itersel -draft ] ] § - -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group r-highlight global WinSetOption filetype=r %{ - require-module r - add-highlighter window/r ref r - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/r } -} - -hook global WinSetOption filetype=r %~ - require-module r - hook window ModeChange pop:insert:.* r-trim-indent - hook window InsertChar \n r-insert-on-newline - hook window InsertChar \n r-indent-on-newline - hook window InsertChar \{ r-indent-on-opening-curly-brace - hook window InsertChar \} r-indent-on-closing-curly-brace - - hook -once -always window WinSetOption filetype=.* %{ remove-hooks window r-.+ } -~