# Detection # --------- hook global BufCreate .*\.(s|S|asm)$ %{ set-option buffer filetype gas } hook -once global BufSetOption filetype=gas %{ require-module gas } provide-module gas %{ add-highlighter shared/gas regions add-highlighter shared/gas/code default-region group add-highlighter shared/gas/string region '"' (? # remove trailing white spaces try %{ execute-keys -draft s \h+$ 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 :$ j ] > ~ 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-.+ } } }