From dee96f8e8282c9146ca8673e844b946d1d53d33e Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 1 Aug 2020 13:37:40 -0600 Subject: [PATCH] Improve syntax highlighting of Ruby percent literals The syntax highlighting has been broken down into 3 main categories: string: string, array of words variable: symbol, array of symbols meta: regexp, shell execution --- rc/filetype/ruby.kak | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 20cfc82b..b813815b 100644 --- a/rc/filetype/ruby.kak +++ b/rc/filetype/ruby.kak @@ -33,7 +33,7 @@ hook -group ruby-highlight global WinSetOption filetype=ruby %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ruby } } -provide-module ruby %[ +provide-module ruby %§ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -48,11 +48,21 @@ add-highlighter shared/ruby/backtick region '(? fill meta -add-highlighter shared/ruby/ region -match-capture '%[iqrswxIQRSWX]?([^0-9A-Za-z\(\{\[<>\]\}\)])' ([^0-9A-Za-z\(\{\[<>\]\}\)]) fill meta +add-highlighter shared/ruby/ region -recurse \( '%[qwQW]?\(' \) fill string +add-highlighter shared/ruby/ region -recurse \{ '%[qwQW]?\{' \} fill string +add-highlighter shared/ruby/ region -recurse \[ '%[qwQW]?\[' \] fill string +add-highlighter shared/ruby/ region -recurse < '%[qwQW]?<' > fill string +add-highlighter shared/ruby/ region -recurse \( '%[isIS]\(' \) fill variable +add-highlighter shared/ruby/ region -recurse \{ '%[isIS]\{' \} fill variable +add-highlighter shared/ruby/ region -recurse \[ '%[isIS]\[' \] fill variable +add-highlighter shared/ruby/ region -recurse < '%[isIS]<' > fill variable +add-highlighter shared/ruby/ region -recurse \( '%[rxRX]\(' \) fill meta +add-highlighter shared/ruby/ region -recurse \{ '%[rxRX]\{' \} fill meta +add-highlighter shared/ruby/ region -recurse \[ '%[rxRX]\[' \] fill meta +add-highlighter shared/ruby/ region -recurse < '%[rxRX]<' > fill meta +add-highlighter shared/ruby/ region -match-capture '%[qwQW]?([^0-9A-Za-z\(\{\[<>\]\}\)])' ([^0-9A-Za-z\(\{\[<>\]\}\)]) fill string +add-highlighter shared/ruby/ region -match-capture '%[isIS]([^0-9A-Za-z\(\{\[<>\]\}\)])' ([^0-9A-Za-z\(\{\[<>\]\}\)]) fill variable +add-highlighter shared/ruby/ region -match-capture '%[rxRX]([^0-9A-Za-z\(\{\[<>\]\}\)])' ([^0-9A-Za-z\(\{\[<>\]\}\)]) fill meta add-highlighter shared/ruby/heredoc region '<<[-~]?(?!self)(\w+)' '^\h*(\w+)$' fill string add-highlighter shared/ruby/division region '[\w\)\]]\K(/|(\h+/\h+))' '\w' group # Help Kakoune to better detect /…/ literals @@ -178,4 +188,4 @@ define-command -hidden ruby-insert-on-new-line %[ ] ] -] +§