diff --git a/rc/base/fish.kak b/rc/base/fish.kak index d8987188a..f6b5d6b77 100644 --- a/rc/base/fish.kak +++ b/rc/base/fish.kak @@ -11,20 +11,19 @@ hook global BufCreate .*[.](fish) %{ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/ regions -default code fish \ - double_string '"' (??@\\\^|~=]|$) $ '' +add-highlighter shared/haskell regions +add-highlighter shared/haskell/code default-region group +add-highlighter shared/haskell/string region (??@\\\^|~=]|$) $ '' fill comment -add-highlighter shared/haskell/string fill string -add-highlighter shared/haskell/comment fill comment -add-highlighter shared/haskell/pragma fill meta -add-highlighter shared/haskell/macro fill meta - -add-highlighter shared/haskell/code regex (?> # not operator keywords: M... M.-> -add-highlighter shared/haskell/code regex \b[A-Z]['\w]*\.[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator +add-highlighter shared/haskell/code/ regex \b[A-Z]['\w]*\.[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator # matches dot: . # not possibly incomplete import: a. # not other operators: !. .! -add-highlighter shared/haskell/code regex (?|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator +add-highlighter shared/haskell/code/ regex (?|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator # matches other operators: ... > < <= ^ <*> <$> etc # not dot: . # not operator keywords: @ .. -> :: ~ -add-highlighter shared/haskell/code regex (?|:!?/.@$*&#%+\^\-\\])[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator +add-highlighter shared/haskell/code/ regex (?|:!?/.@$*&#%+\^\-\\])[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator # matches operator keywords: @ -> -add-highlighter shared/haskell/code regex (?|:!?/.@$*&#%+\^\-\\])(@|~|<-|->|=>|::|=|:|[|])(?![~<=>|:!?/.@$*&#%+\^\-\\]) 1:keyword +add-highlighter shared/haskell/code/ regex (?|:!?/.@$*&#%+\^\-\\])(@|~|<-|->|=>|::|=|:|[|])(?![~<=>|:!?/.@$*&#%+\^\-\\]) 1:keyword # matches: forall [..variables..] . # not the variables -add-highlighter shared/haskell/code regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2:keyword +add-highlighter shared/haskell/code/ regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2:keyword # matches 'x' '\\' '\'' '\n' '\0' # not incomplete literals: '\' # not valid identifiers: w' _' -add-highlighter shared/haskell/code regex \B'([^\\]|[\\]['"\w\d\\])' 0:string +add-highlighter shared/haskell/code/ regex \B'([^\\]|[\\]['"\w\d\\])' 0:string # this has to come after operators so '-' etc is correct # Commands @@ -95,7 +91,7 @@ define-command -hidden haskell-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter window ref haskell } +hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter window/haskell ref haskell } hook global WinSetOption filetype=haskell %{ set-option window extra_word_chars "'" diff --git a/rc/base/html.kak b/rc/base/html.kak index b7b792ac5..5cdc2660e 100644 --- a/rc/base/html.kak +++ b/rc/base/html.kak @@ -15,26 +15,19 @@ hook global BufCreate .*\.xml %{ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/ regions html \ - comment '' \ - tag < > '' \ - style \K (?=) '' \ - script \K (?=) '' +add-highlighter shared/html regions +add-highlighter shared/html/comment region '' fill comment +add-highlighter shared/html/tag region < > '' regions +add-highlighter shared/html/style region \K (?=) '' ref css +add-highlighter shared/html/script region \K (?=) '' ref javascript -add-highlighter shared/html/comment fill comment +add-highlighter shared/html/tag/base default-region group +add-highlighter shared/html/tag/ region '"' (? 0:link -add-highlighter shared/markdown/content regex ^\[[^\]\n]*\]:\h*([^\n]*) 1:link -add-highlighter shared/markdown/content regex ^\h*(>\h*)+ 0:comment -add-highlighter shared/markdown/content regex \H\K\h\h$ 0:PrimarySelection +add-highlighter shared/markdown/content/ regex ^\h?((?:[\s\t]+)?[-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*\n)*$ 0:list 1:bullet +add-highlighter shared/markdown/content/ regex \B\+[^\n]+?\+\B 0:mono +add-highlighter shared/markdown/content/ regex [^`](`([^\s`]|([^\s`](\n?[^\n`])*[^\s`]))`)[^`] 1:mono +add-highlighter shared/markdown/content/ regex [^`](``([^\s`]|([^\s`](\n?[^\n`])*[^\s`]))``)[^`] 1:mono +add-highlighter shared/markdown/content/ regex [^*](\*([^\s*]|([^\s*](\n?[^\n*])*[^\s*]))\*)[^*] 1:italic +add-highlighter shared/markdown/content/ regex [^_](_([^\s_]|([^\s_](\n?[^\n_])*[^\s_]))_)[^_] 1:italic +add-highlighter shared/markdown/content/ regex [^*](\*\*([^\s*]|([^\s*](\n?[^\n*])*[^\s*]))\*\*)[^*] 1:bold +add-highlighter shared/markdown/content/ regex [^_](__([^\s_]|([^\s_](\n?[^\n_])*[^\s_]))__)[^_] 1:bold +add-highlighter shared/markdown/content/ regex <(([a-z]+://.*?)|((mailto:)?[\w+-]+@[a-z]+[.][a-z]+))> 0:link +add-highlighter shared/markdown/content/ regex ^\[[^\]\n]*\]:\h*([^\n]*) 1:link +add-highlighter shared/markdown/content/ regex ^\h*(>\h*)+ 0:comment +add-highlighter shared/markdown/content/ regex \H\K\h\h$ 0:PrimarySelection # Commands # ‾‾‾‾‾‾‾‾ @@ -72,7 +67,7 @@ define-command -hidden markdown-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter window ref markdown } +hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter window/markdown ref markdown } hook global WinSetOption filetype=markdown %{ hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line diff --git a/rc/base/ruby.kak b/rc/base/ruby.kak index ae753ae13..d85a8b198 100644 --- a/rc/base/ruby.kak +++ b/rc/base/ruby.kak @@ -11,43 +11,34 @@ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Capfile|[.]cap)|(Gemfile|[.] # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/ regions -default code -match-capture ruby \ - double_string '"' (? < \ - heredoc '<<[-~]?(\w+)' '^\h*(\w+)$' '' \ - division '[\w\)\]](/|(\h+/\h+))' '\w' '' # Help Kakoune to better detect /…/ literals +add-highlighter shared/ruby regions +add-highlighter shared/ruby/code default-region group +add-highlighter shared/ruby/double_string region '"' (? < fill meta +add-highlighter shared/ruby/heredoc region '<<[-~]?(\w+)' '^\h*(\w+)$' '' fill string +add-highlighter shared/ruby/division region '[\w\)\]](/|(\h+/\h+))' '\w' '' group # Help Kakoune to better detect /…/ literals # Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces) # Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result -add-highlighter shared/ruby/double_string fill string -add-highlighter shared/ruby/double_string regions regions interpolation \Q#{ \} \{ -add-highlighter shared/ruby/double_string/regions/interpolation fill meta +add-highlighter shared/ruby/double_string/ default-region fill string +add-highlighter shared/ruby/double_string/interpolation region \Q#{ \} \{ fill meta -add-highlighter shared/ruby/single_string fill string -add-highlighter shared/ruby/heredoc fill string +add-highlighter shared/ruby/backtick/ default-region fill meta +add-highlighter shared/ruby/backtick/interpolation region \Q#{ \} \{ fill meta -add-highlighter shared/ruby/backtick fill meta -add-highlighter shared/ruby/backtick regions regions interpolation \Q#{ \} \{ -add-highlighter shared/ruby/backtick/regions/interpolation fill meta +add-highlighter shared/ruby/regex/ default-region fill meta +add-highlighter shared/ruby/regex/interpolation region \Q#{ \} \{ fill meta -add-highlighter shared/ruby/regex fill meta -add-highlighter shared/ruby/regex regions regions interpolation \Q#{ \} \{ -add-highlighter shared/ruby/regex/regions/interpolation fill meta - -add-highlighter shared/ruby/comment fill comment - -add-highlighter shared/ruby/literal fill meta - -add-highlighter shared/ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?