diff --git a/rc/gas.kak b/rc/gas.kak new file mode 100644 index 00000000..e9da5f9f --- /dev/null +++ b/rc/gas.kak @@ -0,0 +1,80 @@ +# Detection +# --------- +hook global BufCreate .*\.(s|S|asm)$ %{ + set buffer filetype gas +} + + +addhl -group / regions -default code gas \ + string '"' (? + # remove trailing white spaces + try %{ exec -draft s \h+$ d } + } +} + +def -hidden _gas_indent_on_new_line %~ + eval -draft -itersel %< + # preserve previous line indent + try %{ exec -draft K } + # filter previous line + try %{ exec -draft k : _gas_filter_around_selections } + # indent after label + try %[ exec -draft k :$ j ] + > +~ + +hook global WinSetOption filetype=gas %{ + addhl ref gas + + hook window InsertChar \n -group gas-indent _gas_indent_on_new_line +} + +hook global WinSetOption filetype=(?!gas).* %{ + rmhl gas + + rmhooks window gas-indent +}