From 904cec3c4a329cf89fc3219d359239910d61f3f6 Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 28 Jan 2025 09:14:32 +0000 Subject: init commit --- autoload/filetype/gas.kak | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 autoload/filetype/gas.kak (limited to 'autoload/filetype/gas.kak') diff --git a/autoload/filetype/gas.kak b/autoload/filetype/gas.kak new file mode 100644 index 0000000..73f8db7 --- /dev/null +++ b/autoload/filetype/gas.kak @@ -0,0 +1,99 @@ +# Detection +# --------- +hook global BufCreate .*\.(s|S|asm)$ %{ + set-option buffer filetype gas +} + +hook global WinSetOption filetype=gas %{ + require-module gas + + hook window ModeChange pop:insert:.* -group gas-trim-indent gas-trim-indent + 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 +add-highlighter shared/gas/code default-region group +add-highlighter shared/gas/string region '"' (? d } + } +} + +define-command -hidden gas-indent-on-new-line %~ + evaluate-commands -draft -itersel %< + # preserve previous line indent + try %{ execute-keys -draft K } + # filter previous line + try %{ execute-keys -draft k : gas-trim-indent } + # indent after label + try %[ execute-keys -draft k x :$ j ] + > +~ + +} -- cgit v1.2.3