kakrc: use color aliases for cpp and kakrc highlighting

This commit is contained in:
Maxime Coste 2012-09-17 19:02:08 +02:00
parent 5cf947f845
commit 4d369d6290
3 changed files with 24 additions and 13 deletions

View File

@ -20,3 +20,14 @@ def -shell-params runtime %{ %sh{
done
fi
}
# define color scheme
colalias value red
colalias type yellow
colalias identifier cyan
colalias string magenta
colalias error default,red
colalias keyword blue
colalias attribute green
colalias comment cyan
colalias macro magenta

View File

@ -11,13 +11,13 @@ hook global BufOpen .* %{ %sh{
hook global WinSetOption filetype=cpp %{
addhl group cpp-highlight
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
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
addhl -group cpp-highlight regex "(?<!')\"(\\\"|[^\"])*\"" 0:magenta
addhl -group cpp-highlight regex "(\`|(?<=\n))\h*#\h*[^\n]*" 0:magenta
addhl -group cpp-highlight regex "(//[^\n]*\n)|(/\*.*?(\*/|\'))" 0:cyan
addhl -group cpp-highlight regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value
addhl -group cpp-highlight regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type
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:keyword
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:attribute
addhl -group cpp-highlight regex "(?<!')\"(\\\"|[^\"])*\"" 0:string
addhl -group cpp-highlight regex "(\`|(?<=\n))\h*#\h*[^\n]*" 0:macro
addhl -group cpp-highlight regex "(//[^\n]*\n)|(/\*.*?(\*/|\'))" 0:comment
addfilter group cpp-filters;
addfilter -group cpp-filters preserve_indent;
addfilter -group cpp-filters cleanup_whitespaces;

View File

@ -5,12 +5,12 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
hook global WinSetOption filetype=kak %{
addhl group kak-highlight
addhl -group kak-highlight regex \<(hook|addhl|rmhl|addfilter|rmfilter|exec|source|runtime|def|echo|edit|set[gbw])\> 0:green
addhl -group kak-highlight regex \<(default|black|red|green|yellow|blue|magenta|cyan|white)\> 0:yellow
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 (?<=\<regex)\h+(\S+) 1:magenta
addhl -group kak-highlight regex (["'])(?:\\\1|.)*?\1 0:magenta
addhl -group kak-highlight regex (?<=\<set[gbw])\h+(\S+)\h+(\S+) 1:magenta 2:red
addhl -group kak-highlight regex (^|\h)\#[^\n]*\n 0:cyan
addhl -group kak-highlight regex \<(default|black|red|green|yellow|blue|magenta|cyan|white)\> 0:value
addhl -group kak-highlight regex (?<=\<hook)\h+((global|buffer|window)|(\S+))\h+(\S+)\h+(\H+) 2:attribute 3:error 4:cyan 5:string
addhl -group kak-highlight regex (?<=\<regex)\h+(\S+) 1:string
addhl -group kak-highlight regex (["'])(?:\\\1|.)*?\1 0:string
addhl -group kak-highlight regex (?<=\<set[gbw])\h+(\S+)\h+(\S+) 1:identifier 2:value
addhl -group kak-highlight regex (^|\h)\#[^\n]*\n 0:comment
}
hook global WinSetOption filetype=(?!kak).* %{