diff --git a/rc/base/sql.kak b/rc/base/sql.kak new file mode 100644 index 000000000..7af62fef3 --- /dev/null +++ b/rc/base/sql.kak @@ -0,0 +1,111 @@ +# https://www.w3schools.com/sql/default.asp +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +# Detection +# ‾‾‾‾‾‾‾‾‾ + +hook global BufCreate .*/?(?i)sql %{ + set buffer filetype sql +} + +# Highlighters +# ‾‾‾‾‾‾‾‾‾‾‾‾ + +add-highlighter -group / regions -default code sql \ + string '"' (?|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator +add-highlighter -group /sql/code regex \bNULL\b 0:value +add-highlighter -group /sql/code regex \b\d+(?:\.\d+)?\b 0:value +add-highlighter -group /sql/string fill string +add-highlighter -group /sql/comment fill comment + +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook -group sql-highlight global WinSetOption filetype=sql %{ + add-highlighter ref sql +} + +hook -group sql-highlight global WinSetOption filetype=(?!sql).* %{ + remove-highlighter sql +}