diff --git a/src/highlighters.cc b/src/highlighters.cc index f840293d..0a20fbd9 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -97,34 +97,6 @@ HighlighterAndId colorize_regex_factory(Window& window, ex, fg_color, bg_color)); } -void colorize_cplusplus(DisplayBuffer& display_buffer) -{ - static boost::regex values("\\<(true|false|NULL|nullptr)\\>|\\<-?\\d+[fdiu]?|'((\\\\.)?|[^'\\\\])'"); - colorize_regex(display_buffer, values, Color::Red); - - static boost::regex builtin_types("\\<(void|int|char|unsigned|float|bool|size_t)\\>"); - colorize_regex(display_buffer, builtin_types, Color::Yellow); - - static boost::regex control_keywords("\\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw)\\>"); - colorize_regex(display_buffer, control_keywords, Color::Blue); - - //static boost::regex operators("->|\\+|\\-|\\*|/|\\\\|\\&|\\|\\^|[<>=!+-]=|=|\\(|\\)|\\[|\\]|\\{|\\}|\\<(not|and|or|xor)\\>"); - //colorize_regex(display_buffer, operators, Color::Green); - - static boost::regex types_keywords("\\<(const|auto|namespace|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual)\\>"); - colorize_regex(display_buffer, types_keywords, Color::Green); - - static boost::regex strings("(?("expand_tabs")); registry.register_factory("number_lines", SimpleHighlighterFactory("number_lines")); - registry.register_factory("hlcpp", SimpleHighlighterFactory("hlcpp")); registry.register_factory("regex", colorize_regex_factory); registry.register_factory("group", HighlighterGroup::create); } diff --git a/src/kakrc b/src/kakrc index 1e146197..675a8751 100644 --- a/src/kakrc +++ b/src/kakrc @@ -1,13 +1,5 @@ -hook WinCreate .*\.(c|cc|cpp|cxx|C|h|hh|hpp|hxx|H) \ - addhl hlcpp; \ - addfilter preserve_indent; \ - addfilter cleanup_whitespaces - hook WinInsertEnd .* exec xs\h+(?=\n)d hook WinCreate .* addhl regex \h+(?=\n) default red -hook WinCreate (.*/)?kakrc \ - addhl group hlkakrc; \ - addhl -group hlkakrc regex (hook|addhl|rmhl|addfilter|rmfilter|exec) green default; \ - addhl -group hlkakrc regex (?<=hook)\h+\w+\h+\H+ magenta default; \ - addhl -group hlkakrc regex (?<=hook)\h+\w+ cyan default +runtime rc/cpp.kak +runtime rc/kakrc.kak diff --git a/src/rc/cpp.kak b/src/rc/cpp.kak new file mode 100644 index 00000000..6838fd51 --- /dev/null +++ b/src/rc/cpp.kak @@ -0,0 +1,11 @@ +hook WinCreate .*\.(c|cc|cpp|cxx|C|h|hh|hpp|hxx|H) \ + addhl group hlcpp; \ + addhl -group hlcpp regex "\<(true|false|NULL|nullptr)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" red default; \ + addhl -group hlcpp regex "\<(void|int|char|unsigned|float|bool|size_t)\>" yellow default; \ + addhl -group hlcpp regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw)\>" blue default; \ + addhl -group hlcpp regex "\<(const|auto|namespace|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual)\>" green default; \ + addhl -group hlcpp regex "(?