diff --git a/README.md b/README.md index fbb4129..4e85292 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It has colorful syntax highlighting and integrate with [ccc](https://github.com/ # Usage ```sh -vip -c file # Cat mode +vip -c file # Cat(1) mode with syntax highlighting vip file ``` diff --git a/config.h b/config.h index d2f3090..51304d6 100644 --- a/config.h +++ b/config.h @@ -119,7 +119,7 @@ language_t langs[] = { "//", "/*", "*/", - { "const", "switch", "if", "while", "for", "break", "continue", "return", "else", "struct", "union", "typedef", "static", "enum", "case", "sizeof", "#include", "#define", "#if", "#elseif", "#endif", "int|", "long|", "double|", "float|", "char|", "unsigned|", "void|", "size_t|", "uint8_t|", NULL }, + { "const", "default", "switch", "if", "while", "for", "break", "continue", "return", "else", "struct", "union", "typedef", "static", "enum", "case", "sizeof", "#include", "#define", "#if", "#elseif", "#endif", "int|", "short|", "long|", "double|", "float|", "char|", "unsigned|", "void|", "size_t|", "uint8_t|", NULL }, { ".c", ".h", ".cpp", NULL }, }, }; diff --git a/vip.c b/vip.c index a815c3f..27fc35f 100644 --- a/vip.c +++ b/vip.c @@ -782,12 +782,22 @@ int is_symbol(int c) } void update_highlight(row_t *row) -{ +{ row->hl = realloc(row->hl, row->render_size); memset(row->hl, NORMAL, row->render_size); if (cur_editor->syntax == NULL) return; + if (strcmp(cur_editor->syntax->filetype, "c")) return; + // diff + // --- YELLOW + // +++ PEACH + // @@ OVERLAY0 + // index TEAL + // diff BLUE + // + GREEN + // - RED + char **keywords = cur_editor->syntax->keywords; char *scs = cur_editor->syntax->singleline_comment_start;