Fix various scripts highlighter commands

This commit is contained in:
Maxime Coste 2018-06-30 09:49:57 +10:00
parent 96c9718144
commit 43223fba8c
9 changed files with 53 additions and 60 deletions

View File

@ -13,11 +13,11 @@ hook global BufCreate .*[.](cljs?) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ group clojure
add-highlighter shared/clojure group
add-highlighter shared/clojure ref lisp
add-highlighter shared/clojure/ ref lisp
add-highlighter shared/clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
add-highlighter shared/clojure/ regex \b(clojure.core/['/\w]+)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -27,7 +27,7 @@ define-command -hidden clojure-indent-on-new-line lisp-indent-on-new-line
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter window ref clojure }
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter window/clojure ref clojure }
hook global WinSetOption filetype=clojure %[
hook window ModeChange insert:.* -group clojure-hooks clojure-filter-around-selections

View File

@ -11,17 +11,15 @@ hook global BufCreate .*[.](lisp) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code lisp \
string '"' (?<!\\)(\\\\)*" '' \
comment ';' '$' ''
add-highlighter shared/lisp regions
add-highlighter shared/lisp/code default-region group
add-highlighter shared/lisp/string '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/lisp/comment ';' '$' '' fill comment
add-highlighter shared/lisp/string fill string
add-highlighter shared/lisp/comment fill comment
add-highlighter shared/lisp/code regex \b(nil|true|false)\b 0:value
add-highlighter shared/lisp/code regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator
add-highlighter shared/lisp/code regex \b(([':]\w+)|([*]\H+[*]))\b 0:variable
add-highlighter shared/lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
add-highlighter shared/lisp/code/ regex \b(nil|true|false)\b 0:value
add-highlighter shared/lisp/code/ regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator
add-highlighter shared/lisp/code/ regex \b(([':]\w+)|([*]\H+[*]))\b 0:variable
add-highlighter shared/lisp/code/ regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾
@ -43,7 +41,7 @@ define-command -hidden lisp-indent-on-new-line %{
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter window ref lisp }
hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter window/lisp ref lisp }
hook global WinSetOption filetype=lisp %{
hook window ModeChange insert:.* -group lisp-hooks lisp-filter-around-selections

View File

@ -7,5 +7,5 @@ add-highlighter shared/diff/ regex "^\+[^\n]*\n" 0:green,default
add-highlighter shared/diff/ regex "^-[^\n]*\n" 0:red,default
add-highlighter shared/diff/ regex "^@@[^\n]*@@" 0:cyan,default
hook -group diff-highlight global WinSetOption filetype=diff %{ add-highlighter window ref diff }
hook -group diff-highlight global WinSetOption filetype=diff %{ add-highlighter window/diff ref diff }
hook -group diff-highlight global WinSetOption filetype=(?!diff).* %{ remove-highlighter window/diff }

View File

@ -36,7 +36,7 @@ evaluate-commands %sh{
attributes="global buffer window current
normal insert menu prompt goto view user object
number_lines show_matching show_whitespaces fill regex dynregex group flag_lines
ranges line column wrap ref regions replace-ranges"
ranges line column wrap ref regions region default-region replace-ranges"
types="int bool str regex int-list str-list completions line-specs range-specs"
values="default black red green yellow blue magenta cyan white yes no false true"

View File

@ -27,7 +27,7 @@ evaluate-commands %sh{
}" | tr '|' ' '
# Highlight keywords
printf %s "add-highlighter shared/makefile/content regex \b(${keywords})\b 0:keyword"
printf %s "add-highlighter shared/makefile/content/ regex \b(${keywords})\b 0:keyword"
}
# Commands

View File

@ -127,7 +127,7 @@ define-command clang-enable-autocomplete -docstring "Enable automatic clang comp
}
define-command clang-disable-autocomplete -docstring "Disable automatic clang completion" %{
evaluate-commands %sh{ printf "set-option window completers "; printf %s\\n "'${kak_opt_completers}'" | sed -e "s/'option=clang_completions'//g" }
evaluate-commands %sh{ printf "set-option window completers %s\n" $(printf %s "${kak_opt_completers}" | sed -e "s/'option=clang_completions'//g") }
remove-hooks window clang-autocomplete
unalias window complete clang-complete
}
@ -150,13 +150,13 @@ define-command -hidden clang-show-error-info %{
define-command clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics
Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \
%{
add-highlighter window flag_lines default clang_flags
add-highlighter window/clang_flags flag_lines default clang_flags
hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info }
hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info }
}
define-command clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{
remove-highlighter window/hlflags_clang_flags
remove-highlighter window/clang_flags
remove-hooks window clang-diagnostics
}

View File

@ -2,21 +2,20 @@ hook global BufCreate .+\.cmake|.*/CMakeLists.txt %{
set-option buffer filetype cmake
}
add-highlighter shared/ regions -match-capture -default code cmake \
comment '#' '$' '' \
argument '\w+\h*\(\K' '(?=\))' '\(' \
add-highlighter shared/cmake regions
add-highlighter shared/cmake/code default-region group
add-highlighter shared/cmake/comment region '#' '$' '' fill comment
add-highlighter shared/cmake/argument region '\w+\h*\(\K' '(?=\))' '\(' regions
add-highlighter shared/cmake/argument regions -match-capture -default args argument \
quoted '"' '(?<!\\)(\\\\)*"' '' \
quoted '\[(=*)\[' '\](=*)\]' ''
add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta
add-highlighter shared/cmake/comment fill comment
add-highlighter shared/cmake/code regex '\w+\h*(?=\()' 0:meta
add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' '' group
add-highlighter shared/cmake/argument/raw-quoted region '\[(=*)\[' '\](=*)\]' '' ref cmake/argument/quoted
add-highlighter shared/cmake/argument/argument/args regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/argument/quoted fill string
add-highlighter shared/cmake/argument/argument/quoted regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/argument/quoted regex '\w+\h*(?=\()' 0:function
add-highlighter shared/cmake/argument/quoted/ fill string
add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function
hook -group cmake-highlight global WinSetOption filetype=cmake %{ add-highlighter window ref cmake }
hook -group cmake-highlight global WinSetOption filetype=cmake %{ add-highlighter window/cmake ref cmake }
hook -group cmake-highlight global WinSetOption filetype=(?!cmake).* %{ remove-highlighter window/cmake }

View File

@ -13,10 +13,11 @@ hook global BufCreate .*/?Dockerfile(\.\w+)?$ %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default code dockerfile \
string '"' '(?<!\\)(\\\\)*"' '' \
string "'" "'" '' \
comment '#' $ ''
add-highlighter shared/dockerfile regions
add-highlighter shared/dockerfile/code default-region group
add-highlighter shared/dockerfile/double_string region '"' '(?<!\\)(\\\\)*"' '' fill string
add-highlighter shared/dockerfile/single_string region "'" "'" '' fill string
add-highlighter shared/dockerfile/comment region '#' $ '' fill comment
evaluate-commands %sh{
# Grammar
@ -30,19 +31,16 @@ evaluate-commands %sh{
# Highlight keywords
printf %s "
add-highlighter shared/dockerfile/code regex '^(?i)(ONBUILD\h+)?(${keywords})\b' 2:keyword
add-highlighter shared/dockerfile/code regex '^(?i)(ONBUILD)\h+' 1:keyword
add-highlighter shared/dockerfile/code/ regex '^(?i)(ONBUILD\h+)?(${keywords})\b' 2:keyword
add-highlighter shared/dockerfile/code/ regex '^(?i)(ONBUILD)\h+' 1:keyword
"
}
add-highlighter shared/dockerfile/code regex '\$\{[\w_]+\}' 0:value
add-highlighter shared/dockerfile/code regex '\$[\w_]+' 0:value
add-highlighter shared/dockerfile/string fill string
add-highlighter shared/dockerfile/comment fill comment
add-highlighter shared/dockerfile/code/ regex '\$\{[\w_]+\}' 0:value
add-highlighter shared/dockerfile/code/ regex '\$[\w_]+' 0:value
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter window ref dockerfile }
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{ add-highlighter window/dockerfile ref dockerfile }
hook -group dockerfile-highlight global WinSetOption filetype=(?!dockerfile).* %{ remove-highlighter window/dockerfile }

View File

@ -11,23 +11,21 @@ hook global BufCreate .*\.(toml) %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared regions -default code toml \
comment '#' $ '' \
string '"""' (?<!\\)(\\\\)*""" '' \
string "'''" "'''" '' \
string '"' (?<!\\)(\\\\)*" '' \
string "'" "'" ''
add-highlighter shared/toml regions
add-highlighter shared/toml/code default-region group
add-highlighter shared/toml/comment region '#' $ '' fill comment
add-highlighter shared/toml/string1 region '"""' (?<!\\)(\\\\)*""" '' fill string
add-highlighter shared/toml/string2 region "'''" "'''" '' fill string
add-highlighter shared/toml/string3 region '"' (?<!\\)(\\\\)*" '' fill string
add-highlighter shared/toml/string4 region "'" "'" '' fill string
add-highlighter shared/toml/comment fill comment
add-highlighter shared/toml/string fill string
add-highlighter shared/toml/code regex \
add-highlighter shared/toml/code/ regex \
"^\h*\[\[?([A-Za-z0-9._-]*)\]\]?" 1:title
add-highlighter shared/toml/code regex \
add-highlighter shared/toml/code/ regex \
(?<!\w)[+-]?[0-9](_?\d)*(\.[0-9](_?\d)*)?([eE][+-]?[0-9](_?\d)*)?\b 0:value
add-highlighter shared/toml/code regex \
add-highlighter shared/toml/code/ regex \
true|false 0:value
add-highlighter shared/toml/code regex \
add-highlighter shared/toml/code/ regex \
'\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(.\d+)?([Zz]|[+-]\d{2}:\d{2})' 0:value
# Commands
@ -53,7 +51,7 @@ define-command -hidden toml-indent-on-new-line %{
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group toml-highlight global WinSetOption filetype=toml %{
add-highlighter window ref toml
add-highlighter window/toml ref toml
}
hook global WinSetOption filetype=toml %{