mot: skipping zero-length matches in lbuf_search()
[neatvi.git] / conf.h
blob668a3f49ed0526ad8576b6824dfd925c189435b8
1 /* neatvi configuration file */
3 /* the alternate keymap (^F and ^E in insert mode to switch) */
4 #define KMAPALT "fa"
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 {
13 int dir;
14 char *pat;
15 } dircontexts[] = {
16 {-1, "^[" CR2L "]"},
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 */
25 char *pat;
26 } dirmarks[] = {
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 */
40 } placeholders[] = {
41 {"‌", "-", 1},
42 {"‍", "-", 1},
43 {"ْ", "ـْ", 1},
44 {"ٌ", "ـٌ", 1},
45 {"ٍ", "ـٍ", 1},
46 {"ً", "ـً", 1},
47 {"ُ", "ـُ", 1},
48 {"ِ", "ـِ", 1},
49 {"َ", "ـَ", 1},
50 {"ّ", "ـّ", 1},
53 /* map file names to file types */
54 static struct filetype {
55 char *ft; /* file type */
56 char *pat; /* file name pattern */
57 } filetypes[] = {
58 {"c", "\\.[hc]$"},
59 {"tr", "\\.(ms|tr|roff|tmac)$"},
60 {"tex", "\\.tex$"},
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 */
69 } highlights[] = {
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))