From a276ea3fb586ce046cc90c83cc705fd72ad9d6c5 Mon Sep 17 00:00:00 2001 From: Daniel Robertson Date: Tue, 3 Nov 2015 23:49:11 -0500 Subject: [PATCH] Add filetype for gas assembly files Add hooks for basic syntax highlighting for the gas assembly file type --- rc/gas.kak | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 rc/gas.kak 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 +}