1 /* neatvi configuration file */
3 /* the alternate keymap (^F and ^E in insert mode to switch) */
6 /* right-to-left characters (used only in dircontexts[] and dirmarks[]) */
7 #define CR2L "ءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكلمنهوىييپچژکگی؛،»«؟ًٌٍَُِّْ"
8 /* neutral characters (used only in dircontexts[] and dirmarks[]) */
9 #define CNEUT "-!\"#$%&'()*+,./:;<=>?@^_`{|}~ "
11 /* direction context patterns; specifies the direction of a whole line */
12 static struct dircontext
{
17 {+1, "^[a-zA-Z_0-9]"},
20 /* direction marks; the direction of a few words in a line */
21 static struct dirmark
{
22 int ctx
; /* the direction context for this mark; 0 means any */
23 int dir
; /* the direction of the matched text */
24 int grp
; /* the nested subgroup; 0 means no groups */
27 {+0, +1, 1, "\\\\\\*\\[([^]]+)\\]"},
28 {+1, -1, 0, "[" CR2L
"][" CNEUT CR2L
"]*[" CR2L
"]"},
29 {-1, +1, 0, "[a-zA-Z0-9_][^" CR2L
"\\\\`$']*[a-zA-Z0-9_]"},
30 {+0, +1, 0, "\\$([^$]+)\\$"},
31 {+0, +1, 1, "\\\\[a-zA-Z0-9_]+\\{([^}]+)\\}"},
32 {-1, +1, 0, "\\\\[^ \t" CR2L
"]+"},
35 /* character placeholders */
36 static struct placeholder
{
37 char *s
; /* the source character */
38 char *d
; /* the placeholder */
39 int wid
; /* the width of the placeholder */
53 /* map file names to file types */
54 static struct filetype
{
55 char *ft
; /* file type */
56 char *pat
; /* file name pattern */
59 {"tr", "\\.(ms|tr|roff|tmac)$"},
63 /* syntax highlighting patterns */
64 static struct highlight
{
65 char *ft
; /* the filetype of this pattern */
66 int att
[16]; /* attributes of the matched groups */
67 char *pat
; /* regular expression */
68 int end
; /* the group ending this pattern */
70 {"c", {5}, "\\<(signed|unsigned|char|short|int|long|float|double|void|struct|enum|union|typedef)\\>"},
71 {"c", {5}, "\\<(static|extern|register)\\>"},
72 {"c", {4}, "\\<(return|for|while|if|else|do|sizeof|goto|switch|case|default|break|continue)\\>"},
73 {"c", {2 | SYN_IT
}, "//.*$"},
74 {"c", {2 | SYN_IT
}, "/\\*([^*]|\\*[^/])*\\*/"},
75 {"c", {6}, "^#[ \t]*[a-zA-Z0-9_]+"},
76 {"c", {0, SYN_BD
}, "([a-zA-Z][a-zA-Z0-9_]+)\\(", 1},
77 {"c", {4}, "\"([^\"]|\\\\\")*\""},
78 {"c", {4}, "'([^\\]|\\\\.)'"},
80 {"tr", {4, 0, 5 | SYN_BD
, 4 | SYN_BD
, 5 | SYN_BD
, 4 | SYN_BD
},
81 "^[.'][ \t]*((SH.*)|(de) (.*)|([^ \t\\]{2,}))?.*$", 1},
82 {"tr", {2 | SYN_IT
}, "\\\\\".*$"},
83 {"tr", {3}, "\\\\{1,2}[*$fgkmns]([^[(]|\\(..|\\[[^]]*\\])"},
84 {"tr", {3}, "\\\\([^[(*$fgkmns]|\\(..|\\[[^]]*\\])"},
85 {"tr", {3}, "\\$[^$]+\\$"},
87 {"tex", {4 | SYN_BD
, 0, 3, 0, 5},
88 "\\\\[^[{ \t]+(\\[([^]]+)\\])?(\\{([^}]*)\\})?"},
89 {"tex", {3}, "\\$[^$]+\\$"},
90 {"tex", {2 | SYN_IT
}, "%.*$"},
93 /* how to hightlight text in the reverse direction */
94 #define SYN_REVDIR (SYN_BGMK(7))