summaryrefslogtreecommitdiff
path: root/rc/cpp.kak
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-06-11 23:29:23 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-06-11 23:29:23 +0100
commitdac5e89e140541492618aeaa896df62f4d4f62ad (patch)
tree057933b0aab686f77ea1fd9d5f390b977373b803 /rc/cpp.kak
parent0faf7ff5e609a7b3fcf17586066f986460385fce (diff)
Add MultiRegionHighlighter
MultiRegionHighlighter provides a way to segment the buffer in logical regions using the common left-most rule for finding the next region. It then provides highlighting groups for each region that can be filled.
Diffstat (limited to 'rc/cpp.kak')
-rw-r--r--rc/cpp.kak22
1 files changed, 12 insertions, 10 deletions
diff --git a/rc/cpp.kak b/rc/cpp.kak
index 812c5065..bd6651f8 100644
--- a/rc/cpp.kak
+++ b/rc/cpp.kak
@@ -40,19 +40,21 @@ def -hidden _cpp_indent_on_closing_curly_brace %[
]
defhl cpp
-addhl -def-group cpp regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value
-addhl -def-group cpp regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type
-addhl -def-group cpp regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw|new|delete|and|or|not|operator|explicit)\>" 0:keyword
-addhl -def-group cpp regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual|friend|extern|typename|override|final)\>" 0:attribute
-addhl -def-group cpp regex "^\h*?#.*?(?<!\\)$" 0:macro
-addhl -def-group cpp region string %{(?<!')"} %{(?<!\\)(\\\\)*"}
-addhl -def-group cpp/string/content fill string
+addhl -def-group cpp multi_region -default code root \
+ string %{(?<!')"} %{(?<!\\)(\\\\)*"} '' \
+ comment /\* \*/ ''
-addhl -def-group cpp region comment /\* \*/
-addhl -def-group cpp/comment/content fill comment
+addhl -def-group cpp/root/string fill string
+addhl -def-group cpp/root/comment fill comment
-addhl -def-group cpp regex "(//[^\n]*\n)" 0:comment
+addhl -def-group cpp/root/code regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value
+addhl -def-group cpp/root/code regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type
+addhl -def-group cpp/root/code regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw|new|delete|and|or|not|operator|explicit)\>" 0:keyword
+addhl -def-group cpp/root/code regex "\<(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual|friend|extern|typename|override|final)\>" 0:attribute
+addhl -def-group cpp/root/code regex "^\h*?#.*?(?<!\\)$" 0:macro
+
+addhl -def-group cpp/root/code regex "(//[^\n]*\n)" 0:comment
hook global WinSetOption filetype=cpp %[
addhl ref cpp