use new regex highlighter features in rc files

This commit is contained in:
Maxime Coste 2012-08-07 00:28:55 +02:00
parent 02b7786bcd
commit c166bc92e3
2 changed files with 9 additions and 13 deletions

View File

@ -4,13 +4,13 @@ hook global BufCreate .*\.(c|cc|cpp|cxx|C|h|hh|hpp|hxx|H) %{
hook global WinSetOption filetype=cpp %{ hook global WinSetOption filetype=cpp %{
addhl group cpp-highlight; addhl group cpp-highlight;
addhl -group cpp-highlight regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:red,default; addhl -group cpp-highlight regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:red
addhl -group cpp-highlight regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:yellow,default; addhl -group cpp-highlight regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:yellow
addhl -group cpp-highlight regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw|new|delete|and|or|not)\>" 0:blue,default; addhl -group cpp-highlight regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw|new|delete|and|or|not)\>" 0:blue
addhl -group cpp-highlight regex "\<(const|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual|friend|extern|typename)\>" 0:green,default; addhl -group cpp-highlight regex "\<(const|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual|friend|extern|typename)\>" 0:green
addhl -group cpp-highlight regex "(?<!')\"(\\\"|[^\"])*\"" 0:magenta,default; addhl -group cpp-highlight regex "(?<!')\"(\\\"|[^\"])*\"" 0:magenta
addhl -group cpp-highlight regex "(\`|(?<=\n))\h*#\h*[^\n]*" 0:magenta,default; addhl -group cpp-highlight regex "(\`|(?<=\n))\h*#\h*[^\n]*" 0:magenta
addhl -group cpp-highlight regex "(//[^\n]*\n)|(/\*.*?(\*/|\'))" 0:cyan,default; addhl -group cpp-highlight regex "(//[^\n]*\n)|(/\*.*?(\*/|\'))" 0:cyan
addfilter group cpp-filters; addfilter group cpp-filters;
addfilter -group cpp-filters preserve_indent; addfilter -group cpp-filters preserve_indent;
addfilter -group cpp-filters cleanup_whitespaces; addfilter -group cpp-filters cleanup_whitespaces;

View File

@ -6,13 +6,9 @@ hook global WinSetOption filetype=kak %{
addhl group kak-highlight addhl group kak-highlight
addhl -group kak-highlight regex \<(hook|addhl|rmhl|addfilter|rmfilter|exec|source|runtime|def|echo|edit|set[gbw])\> 0:green,default addhl -group kak-highlight regex \<(hook|addhl|rmhl|addfilter|rmfilter|exec|source|runtime|def|echo|edit|set[gbw])\> 0:green,default
addhl -group kak-highlight regex \<(default|black|red|green|yellow|blue|magenta|cyan|white)\> 0:yellow,default addhl -group kak-highlight regex \<(default|black|red|green|yellow|blue|magenta|cyan|white)\> 0:yellow,default
addhl -group kak-highlight regex (?<=\<hook)(\h+\w+){2}\h+\H+ 0:magenta,default addhl -group kak-highlight regex (?<=\<hook)\h+((global|buffer|window)|(\S+))\h+(\S+)\h+(\H+) 2:blue 3:red 4:cyan 5:magenta
addhl -group kak-highlight regex (?<=\<hook)(\h+\w+){2} 0:cyan,default
addhl -group kak-highlight regex (?<=\<hook)(\h+\w+) 0:red,default
addhl -group kak-highlight regex (?<=\<hook)(\h+(global|buffer|window)) 0:blue,default
addhl -group kak-highlight regex (?<=\<regex)\h+\S+ 0:magenta,default addhl -group kak-highlight regex (?<=\<regex)\h+\S+ 0:magenta,default
addhl -group kak-highlight regex (?<=\<set[gbw])\h+\S+\h+\S+ 0:magenta,default addhl -group kak-highlight regex (?<=\<set[gbw])\h+(\S+)\h+(\S+) 1:magenta 2:red
addhl -group kak-highlight regex (?<=\<set[gbw])\h+\S+ 0:red,default
} }
hook global WinSetOption filetype=(?!kak).* %{ hook global WinSetOption filetype=(?!kak).* %{