summaryrefslogtreecommitdiff
path: root/rc/filetype/lua.kak
diff options
context:
space:
mode:
authorJustin Frank <justinpfrank@protonmail.com>2019-04-09 20:54:19 -0700
committerJustin Frank <justinpfrank@protonmail.com>2019-04-09 20:54:19 -0700
commit80ac46e09de0a30c0bf590fd50b6cbf9bfd1c41b (patch)
treed4abde4c341a026d56512d74f79608d6a45ec85a /rc/filetype/lua.kak
parent887a5223ac8e71ca6d7f0cd9c764d68ce3d90dbe (diff)
Fixed many of the filetype support modules to not use `BufSetOption` to load
Diffstat (limited to 'rc/filetype/lua.kak')
-rw-r--r--rc/filetype/lua.kak43
1 files changed, 21 insertions, 22 deletions
diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak
index c3411c91..ed97cbb8 100644
--- a/rc/filetype/lua.kak
+++ b/rc/filetype/lua.kak
@@ -8,10 +8,30 @@ hook global BufCreate .*[.](lua) %{
set-option buffer filetype lua
}
-hook -once global BufSetOption filetype=lua %{
+# Initialization
+# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
+
+hook global WinSetOption filetype=lua %{
require-module lua
+
+ hook window InsertChar .* -group lua-indent lua-indent-on-char
+ hook window InsertChar \n -group lua-indent lua-indent-on-new-line
+ hook window InsertChar \n -group lua-insert lua-insert-on-new-line
+
+ alias window alt lua-alternative-file
+
+ hook -once -always window WinSetOption filetype=.* %{
+ remove-hooks window lua-.+
+ unalias window alt lua-alternative-file
+ }
+}
+
+hook -group lua-highlight global WinSetOption filetype=lua %{
+ add-highlighter window/lua ref lua
+ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua }
}
+
provide-module lua %[
# Highlighters
@@ -87,25 +107,4 @@ define-command -hidden lua-insert-on-new-line %[
]
]
-# Initialization
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group lua-highlight global WinSetOption filetype=lua %{
- add-highlighter window/lua ref lua
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua }
-}
-
-hook global WinSetOption filetype=lua %{
- hook window InsertChar .* -group lua-indent lua-indent-on-char
- hook window InsertChar \n -group lua-indent lua-indent-on-new-line
- hook window InsertChar \n -group lua-insert lua-insert-on-new-line
-
- alias window alt lua-alternative-file
-
- hook -once -always window WinSetOption filetype=.* %{
- remove-hooks window lua-.+
- unalias window alt lua-alternative-file
- }
-}
-
]