From 90961b0990102691c3bd9ba9a40b66d103e5e979 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sat, 9 Sep 2017 11:50:09 +0300 Subject: [PATCH] rc: Add support for MySQL, SQL Server and MS Access Closes #1540 --- rc/base/sql.kak | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 rc/base/sql.kak 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 +}