ex: edit command and unspecified alternate file
[neatvi.git] / conf.h
blobc9a141e9cefed9a46a87e9c79849c5c3820706f0
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)$"},
62 /* syntax highlighting patterns */
63 static struct highlight {
64 char *ft; /* the filetype of this pattern */
65 int att; /* attributes of the matched region */
66 int grp; /* regular expression subgroup to highlight */
67 char *pat; /* regular expression */
68 } highlights[] = {
69 {"c", 5, 0, "\\<(signed|unsigned|char|short|int|long|float|double|void|struct|enum|union|typedef)\\>"},
70 {"c", 5, 0, "\\<(static|extern|register)\\>"},
71 {"c", 5, 0, "\\<(return|for|while|if|else|do|sizeof|goto|switch|case|default|break|continue)\\>"},
72 {"c", 2 | SYN_IT, 0, "//.*$"},
73 {"c", 2 | SYN_IT, 0, "/\\*([^*]|\\*[^/])*\\*/"},
74 {"c", 6, 0, "^#[ \t]*[a-zA-Z0-9_]+"},
75 {"c", SYN_BD, 1, "([a-zA-Z][a-zA-Z0-9_]+)\\("},
76 {"c", 4, 0, "\"([^\"]|\\\\\")*\""},
77 {"c", 4, 0, "'([^\\]|\\\\.)'"},
79 {"tr", SYN_BD, 0, "^\\.SH.*$"},
80 {"tr", 4, 0, "^\\.[a-zA-Z0-9]{2}.*$"},
83 /* how to hightlight text in the reverse direction */
84 #define SYN_REVDIR (SYN_BGMK(7))