1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-27 12:16:22 +03:00

Fix tests and required scripts to get back to green make test

This commit is contained in:
Maxime Coste 2018-06-28 22:10:22 +10:00
parent 1574748d4e
commit f61bcef469
20 changed files with 141 additions and 174 deletions

View File

@ -11,20 +11,19 @@ hook global BufCreate .*[.](fish) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code fish \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" "'" '' \
comment '#' '$' ''
add-highlighter shared/fish regions
add-highlighter shared/fish/code default-region group
add-highlighter shared/fish/double_string '"' (?<!\\)(\\\\)*" '' group
add-highlighter shared/fish/single_string "'" "'" '' fill string
add-highlighter shared/fish/comment '#' '$' '' fill comment
add-highlighter shared/fish/double_string fill string
add-highlighter shared/fish/double_string regex (\$\w+)|(\{\$\w+\}) 0:variable
add-highlighter shared/fish/single_string fill string
add-highlighter shared/fish/comment fill comment
add-highlighter shared/fish/double_string/ fill string
add-highlighter shared/fish/double_string/ regex (\$\w+)|(\{\$\w+\}) 0:variable
add-highlighter shared/fish/code regex (\$\w+)|(\{\$\w+\}) 0:variable
add-highlighter shared/fish/code/ regex (\$\w+)|(\{\$\w+\}) 0:variable
# Command names are collected using `builtin --names` and 'eval' from `functions --names`
add-highlighter shared/fish/code regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword
add-highlighter shared/fish/code/ regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -71,7 +70,7 @@ define-command -hidden fish-insert-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter window ref fish }
hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter window/fish ref fish }
hook global WinSetOption filetype=fish %{
hook window InsertChar .* -group fish-indent fish-indent-on-char

View File

@ -3,10 +3,10 @@ hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{
}
hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
add-highlighter window group git-commit-highlight
add-highlighter window/git-commit-highlight regex "^\h*#[^\n]*\n" 0:cyan,default
add-highlighter window/git-commit-highlight regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta
add-highlighter window/git-commit-highlight ref diff # highlight potential diffs from the -v option
add-highlighter window/git-commit-highlight group
add-highlighter window/git-commit-highlight/ regex "^\h*#[^\n]*\n" 0:cyan,default
add-highlighter window/git-commit-highlight/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta
add-highlighter window/git-commit-highlight/ ref diff # highlight potential diffs from the -v option
}
hook -group git-commit-highlight global WinSetOption filetype=(?!git-commit).* %{ remove-highlighter window/git-commit-highlight }
@ -16,9 +16,9 @@ hook global BufCreate .*git-rebase-todo %{
}
hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
add-highlighter window group git-rebase-highlight
add-highlighter window/git-rebase-highlight regex "#[^\n]*\n" 0:cyan,default
add-highlighter window/git-rebase-highlight regex "^(pick|edit|reword|squash|fixup|exec|delete|[persfxd]) (\w+)" 1:green 2:magenta
add-highlighter window/git-rebase-highlight group
add-highlighter window/git-rebase-highlight/ regex "#[^\n]*\n" 0:cyan,default
add-highlighter window/git-rebase-highlight/ regex "^(pick|edit|reword|squash|fixup|exec|delete|[persfx]) (\w+)" 1:green 2:magenta
}
hook -group git-rebase-highlight global WinSetOption filetype=(?!git-rebase).* %{ remove-highlighter window/git-rebase-highlight }

View File

@ -11,24 +11,20 @@ hook global BufCreate .*[.](hs) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code haskell \
string (?<!'\\)(?<!')" (?<!\\)(\\\\)*" '' \
macro ^\h*?\K# (?<!\\)\n '' \
pragma \{-# '#-\}' \{- \
comment \{- -\} \{- \
comment --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ ''
add-highlighter shared/haskell regions
add-highlighter shared/haskell/code default-region group
add-highlighter shared/haskell/string region (?<!'\\)(?<!')" (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/haskell/macro region ^\h*?\K# (?<!\\)\n '' fill meta
add-highlighter shared/haskell/pragma region \{-# '#-\}' \{- fill meta
add-highlighter shared/haskell/comment region \{- -\} \{- fill comment
add-highlighter shared/haskell/line_comment 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 (?<!')\b0x+[A-Fa-f0-9]+ 0:value
add-highlighter shared/haskell/code regex (?<!')\b\d+([.]\d+)? 0:value
add-highlighter shared/haskell/code regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword
add-highlighter shared/haskell/code regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword
add-highlighter shared/haskell/code regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword
add-highlighter shared/haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute
add-highlighter shared/haskell/code/ regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value
add-highlighter shared/haskell/code/ regex (?<!')\b\d+([.]\d+)? 0:value
add-highlighter shared/haskell/code/ regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword
add-highlighter shared/haskell/code/ regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword
add-highlighter shared/haskell/code/ regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword
add-highlighter shared/haskell/code/ regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute
# The complications below is because period has many uses:
# As function composition operator (possibly without spaces) like "." and "f.g"
@ -39,32 +35,32 @@ add-highlighter shared/haskell/code regex (?<!')\b(case|do|else|if|in|let|mdo|of
# matches uppercase identifiers: Monad Control.Monad
# not non-space separated dot: Just.const
add-highlighter shared/haskell/code regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!['\w])(?![.a-z]) 0:variable
add-highlighter shared/haskell/code/ regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!['\w])(?![.a-z]) 0:variable
# matches infix identifier: `mod` `Apa._T'M`
add-highlighter shared/haskell/code regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator
add-highlighter shared/haskell/code/ regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator
# matches imported operators: M.! M.. Control.Monad.>>
# 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 (?<![\w~<=>|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator
add-highlighter shared/haskell/code/ regex (?<![\w~<=>|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 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 "'"

View File

@ -15,26 +15,19 @@ hook global BufCreate .*\.xml %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions html \
comment <!-- --> '' \
tag < > '' \
style <style\b.*?>\K (?=</style>) '' \
script <script\b.*?>\K (?=</script>) ''
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 <style\b.*?>\K (?=</style>) '' ref css
add-highlighter shared/html/script region <script\b.*?>\K (?=</script>) '' ref javascript
add-highlighter shared/html/comment fill comment
add-highlighter shared/html/tag/base default-region group
add-highlighter shared/html/tag/ region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/html/tag/ region "'" "'" '' fill string
add-highlighter shared/html/style ref css
add-highlighter shared/html/script ref javascript
add-highlighter shared/html/tag regex \b([a-zA-Z0-9_-]+)=? 1:attribute
add-highlighter shared/html/tag regex </?(\w+) 1:keyword
add-highlighter shared/html/tag regex <(!DOCTYPE(\h+\w+)+) 1:meta
add-highlighter shared/html/tag regions content \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" ''
add-highlighter shared/html/tag/content/string fill string
add-highlighter shared/html/tag/base/ regex \b([a-zA-Z0-9_-]+)=? 1:attribute
add-highlighter shared/html/tag/base/ regex </?(\w+) 1:keyword
add-highlighter shared/html/tag/base/ regex <(!DOCTYPE(\h+\w+)+) 1:meta
# Commands
# ‾‾‾‾‾‾‾‾
@ -65,7 +58,7 @@ define-command -hidden html-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter window ref html }
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter window/html ref html }
hook global WinSetOption filetype=(?:html|xml) %{
hook window ModeChange insert:.* -group html-hooks html-filter-around-selections

View File

@ -11,18 +11,15 @@ hook global BufCreate .*[.](lua) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code -match-capture lua \
string '"' (?<!\\)(?:\\\\)*" '' \
string "'" (?<!\\)(?:\\\\)*' '' \
string '\[(=*)\[' '\](=*)\]' '' \
comment '--\[(=*)\[' '\](=*)\]' '' \
comment '--' '$' '' \
add-highlighter shared/lua regions
add-highlighter shared/lua/code default-region group
add-highlighter shared/lua/double_string region '"' (?<!\\)(?:\\\\)*" '' fill string
add-highlighter shared/lua/single_string region "'" (?<!\\)(?:\\\\)*' '' fill string
add-highlighter shared/lua/comment region -- '--' $ '' fill comment
add-highlighter shared/lua/raw_string region -match-capture '\[(=*)\[' '\](=*)\]' '' fill string
add-highlighter shared/lua/raw_comment region -match-capture -- '--\[(=*)\[' '\](=*)\]' '' fill comment
add-highlighter shared/lua/string fill string
add-highlighter shared/lua/comment fill comment
add-highlighter shared/lua/code regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword
add-highlighter shared/lua/code/ regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -87,7 +84,7 @@ define-command -hidden lua-insert-on-new-line %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter window ref lua }
hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter window/lua ref lua }
hook global WinSetOption filetype=lua %{
hook window InsertChar .* -group lua-indent lua-indent-on-char

View File

@ -11,6 +11,10 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/markdown regions
add-highlighter shared/markdown/content default-region group
add-highlighter shared/markdown/code region ``` ``` '' fill meta
evaluate-commands %sh{
languages="
c cabal clojure coffee cpp css cucumber d diff dockerfile fish gas go
@ -18,42 +22,33 @@ evaluate-commands %sh{
lisp lua makefile markdown moon objc perl pug python ragel ruby rust
sass scala scss sh swift tupfile typescript yaml
"
echo 'add-highlighter shared/ regions -default content markdown \'
for lang in ${languages}; do
printf '%s ```\h*%s\\b ``` "" ' "${lang}" "${lang}"
done
echo 'code ``` ``` ""'
for lang in ${languages}; do
printf 'add-highlighter shared/markdown/%s region ```\h*%s\\b ``` "" regions\n' "${lang}" "${lang}"
printf 'add-highlighter shared/markdown/%s/ default-region fill meta\n' "${lang}"
ref=$([ "${lang}" = kak ] && echo kakrc || echo "${lang}")
printf '
add-highlighter shared/markdown/%s/ regions -default fence outer inner \A```[^\\n]*\K (?=```) ""
add-highlighter shared/markdown/%s/outer/fence fill meta
add-highlighter shared/markdown/%s/outer/inner ref %s
' "${lang}" "${lang}" "${lang}" "${ref}"
printf 'add-highlighter shared/markdown/%s/inner region \A```[^\\n]*\K (?=```) "" ref %s\n' "${lang}" "${ref}"
done
}
add-highlighter shared/markdown/code fill meta
# Setext-style header
add-highlighter shared/markdown/content regex (\A|\n\n)[^\n]+\n={2,}\h*\n\h*$ 0:title
add-highlighter shared/markdown/content regex (\A|\n\n)[^\n]+\n-{2,}\h*\n\h*$ 0:header
add-highlighter shared/markdown/content/ regex (\A|\n\n)[^\n]+\n={2,}\h*\n\h*$ 0:title
add-highlighter shared/markdown/content/ regex (\A|\n\n)[^\n]+\n-{2,}\h*\n\h*$ 0:header
# Atx-style header
add-highlighter shared/markdown/content regex ^(#+)(\h+)([^\n]+) 1:header
add-highlighter shared/markdown/content/ regex ^(#+)(\h+)([^\n]+) 1:header
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
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

View File

@ -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 '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
backtick '`' (?<!\\)(\\\\)*` '' \
regex '/' (?<!\\)(\\\\)*/[imox]* '' \
comment '#' '$' '' \
comment ^begin= ^=end '' \
literal '%[iqrswxIQRSWX]\(' \) \( \
literal '%[iqrswxIQRSWX]\{' \} \{ \
literal '%[iqrswxIQRSWX]\[' \] \[ \
literal '%[iqrswxIQRSWX]<' > < \
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 '"' (?<!\\)(\\\\)*" '' regions
add-highlighter shared/ruby/single_string region "'" (?<!\\)(\\\\)*' '' fill string
add-highlighter shared/ruby/backtick region '`' (?<!\\)(\\\\)*` '' regions
add-highlighter shared/ruby/regex region '/' (?<!\\)(\\\\)*/[imox]* '' regions
add-highlighter shared/ruby/ region '#' '$' '' fill comment
add-highlighter shared/ruby/ region ^begin= ^=end '' fill comment
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\(' \) \( fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\{' \} \{ fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]\[' \] \[ fill meta
add-highlighter shared/ruby/ region '%[iqrswxIQRSWX]<' > < 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*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable
add-highlighter shared/ruby/code/ regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|((?<!:):(([A-Za-z]\w*[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable
evaluate-commands %sh{
# Grammar
@ -67,10 +58,10 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/ruby/code regex \b(${keywords})\b 0:keyword
add-highlighter shared/ruby/code regex \b(${attributes})\b 0:attribute
add-highlighter shared/ruby/code regex \b(${values})\b 0:value
add-highlighter shared/ruby/code regex \b(${meta})\b 0:meta
add-highlighter shared/ruby/code/ regex \b(${keywords})\b 0:keyword
add-highlighter shared/ruby/code/ regex \b(${attributes})\b 0:attribute
add-highlighter shared/ruby/code/ regex \b(${values})\b 0:value
add-highlighter shared/ruby/code/ regex \b(${meta})\b 0:meta
"
}
@ -153,7 +144,7 @@ define-command -hidden ruby-insert-on-new-line %[
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter window ref ruby }
hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter window/ruby ref ruby }
hook global WinSetOption filetype=ruby %{
hook window InsertChar .* -group ruby-indent ruby-indent-on-char

View File

@ -11,20 +11,18 @@ hook global BufCreate .*[.](sass) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code sass \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" '' \
comment '/' '$' ''
add-highlighter shared/sass regions
add-highlighter shared/sass/code default-region group
add-highlighter shared/sass/single_string region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/sass/double_string region "'" "'" '' fill string
add-highlighter shared/sass/comment region '/' '$' '' fill comment
add-highlighter shared/sass/string fill string
add-highlighter shared/sass/comment fill comment
add-highlighter shared/sass/code regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
add-highlighter shared/sass/code regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta
add-highlighter shared/sass/code regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value
add-highlighter shared/sass/code regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter shared/sass/code regex :(before|after) 0:attribute
add-highlighter shared/sass/code regex !important 0:keyword
add-highlighter shared/sass/code/ regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
add-highlighter shared/sass/code/ regex &|@[A-Za-z][A-Za-z0-9_-]* 0:meta
add-highlighter shared/sass/code/ regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(em|px)) 0:value
add-highlighter shared/sass/code/ regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
add-highlighter shared/sass/code/ regex :(before|after) 0:attribute
add-highlighter shared/sass/code/ regex !important 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -50,7 +48,7 @@ define-command -hidden sass-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window ref sass }
hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window/sass ref sass }
hook global WinSetOption filetype=sass %{
hook window ModeChange insert:.* -group sass-hooks sass-filter-around-selections

View File

@ -1,5 +1,5 @@
add-highlighter window number_lines
add-highlighter window/ number_lines
set window tabstop 4
add-highlighter window column 3 default,red
add-highlighter window column 7 default,green
add-highlighter window column 5 default,blue
add-highlighter window/ column 3 default,red
add-highlighter window/ column 7 default,green
add-highlighter window/ column 5 default,blue

View File

@ -1,7 +1,4 @@
add-highlighter window regions -default code regions_test \
string %{"} %{(?<!\\)(\\\\)*"} '' \
shell '\$\{' '\}' '\{'
add-highlighter window/regions_test/code fill yellow
add-highlighter window/regions_test/string fill green
add-highlighter window/regions_test/shell fill red
add-highlighter window/regions_test regions
add-highlighter window/regions_test/code default-region fill yellow
add-highlighter window/regions_test/string region %{"} %{(?<!\\)(\\\\)*"} '' fill green
add-highlighter window/regions_test/shell region '\$\{' '\}' '\{' fill red

View File

@ -1 +1 @@
add-highlighter window wrap -word
add-highlighter window/ wrap -word

View File

@ -1,2 +1,3 @@
add-highlighter window regions -default code -match-capture sh \
heredoc '<<-?(\w+)' '^\t*(\w+)$' ''
add-highlighter window/sh regions
add-highlighter window/sh/code default-region group
add-highlighter window/sh/heredoc region -match-capture '<<-?(\w+)' '^\t*(\w+)$' '' group

View File

@ -1 +1 @@
add-highlighter window column 20 default,blue
add-highlighter window/ column 20 default,blue

View File

@ -1,2 +1,2 @@
add-highlighter window wrap
add-highlighter window/ wrap
set global scrolloff 1,0

View File

@ -1 +1 @@
add-highlighter window show_whitespaces
add-highlighter window/ show_whitespaces

View File

@ -1 +1 @@
add-highlighter window show_whitespaces
add-highlighter window/ show_whitespaces

View File

@ -1 +1 @@
add-highlighter window wrap
add-highlighter window/ wrap

View File

@ -1 +1 @@
add-highlighter window wrap
add-highlighter window/ wrap

View File

@ -1 +1 @@
add-highlighter window number_lines
add-highlighter window/ number_lines

View File

@ -1 +1 @@
add-highlighter window regex '[“”]' 0:red
add-highlighter window/ regex '[“”]' 0:red