Only accept c for highlight, more keywords and update readme for cat mode
This commit is contained in:
parent
8541312ec0
commit
3fed4d81c8
3 changed files with 13 additions and 3 deletions
|
@ -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
|
||||
```
|
||||
|
||||
|
|
2
config.h
2
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 },
|
||||
},
|
||||
};
|
||||
|
|
12
vip.c
12
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;
|
||||
|
|
Loading…
Reference in a new issue