tconf.h - neatvi - [fork] simple vi-type editor with UTF-8 support | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
tconf.h (2523B) | |
--- | |
1 /* neatvi configuration file */ | |
2 | |
3 /* access mode of new files */ | |
4 #define MKFILE_MODE 0600 | |
5 | |
6 /* map file names to file types */ | |
7 static struct filetype { | |
8 char *ft; /* file type */ | |
9 char *pat; /* file name pattern */ | |
10 } filetypes[] = { | |
11 {"c", "\\.[hc]$"}, /* C */ | |
12 {"roff", "\\.(ms|me|mom|tr|roff|tmac|txt|[1-9])$"}, /* tr… | |
13 {"tex", "\\.tex$"}, /* tex */ | |
14 {"msg", "letter$|mbox$|mail$"}, /* email … | |
15 {"mk", "Makefile$|makefile$|\\.mk$"}, /* makefile… | |
16 {"sh", "\\.sh$"}, /* shell script… | |
17 {"py", "\\.py$"}, /* python */ | |
18 {"bib", "bib$"}, /* refer */ | |
19 {"nm", "\\.nm$"}, /* neatmail */ | |
20 {"diff", "\\.(patch|diff)$"} /* diff */ | |
21 }; | |
22 | |
23 /* syntax highlighting patterns */ | |
24 static struct highlight { | |
25 char *ft; /* the filetype of this pattern */ | |
26 int att[16]; /* attributes of the matched groups … | |
27 char *pat; /* regular expression */ | |
28 int end; /* the group ending this pattern */ | |
29 } highlights[] = { | |
30 {"invalid", {0}, ""}, | |
31 }; | |
32 | |
33 /* how to hightlight current line (hll option) */ | |
34 #define SYN_LINE (SYN_BGMK(11)) | |
35 | |
36 /* how to hightlight text in the reverse direction */ | |
37 #define SYN_REVDIR (SYN_BGMK(7)) | |
38 | |
39 /* define it as "\33[8l" to disable BiDi in vte-based terminals */ | |
40 #define LNPREF "" | |
41 | |
42 /* right-to-left characters (used only in dircontexts[] and dirmarks[]) … | |
43 #define CR2L "ءآأؤإئابةتثجحخدذرزسشص�… | |
44 /* neutral characters (used only in dircontexts[] and dirmarks[]) */ | |
45 #define CNEUT "-!\"#$%&'()*+,./:;<=>?@^_`{|}~ " | |
46 | |
47 /* direction context patterns; specifies the direction of a whole line */ | |
48 static struct dircontext { | |
49 int dir; | |
50 char *pat; | |
51 } dircontexts[] = { | |
52 {-1, "^[" CR2L "]"}, | |
53 {+1, "^[a-zA-Z_0-9]"}, | |
54 }; | |
55 | |
56 /* direction marks; the direction of a few words in a line */ | |
57 static struct dirmark { | |
58 int ctx; /* the direction context for this mark; 0 means … | |
59 int dir; /* the direction of the matched text */ | |
60 int grp; /* the nested subgroup; 0 means no groups */ | |
61 char *pat; | |
62 } dirmarks[] = { | |
63 {+0, +1, 1, "\\\\\\*\\[([^]]+)\\]"}, | |
64 {+1, -1, 0, "[" CR2L "][" CNEUT CR2L "]*[" CR2L "]"}, | |
65 {-1, +1, 0, "[a-zA-Z0-9_][^" CR2L "\\\\`$']*[a-zA-Z0-9_]"}, | |
66 {+0, +1, 0, "\\$([^$]+)\\$"}, | |
67 {+0, +1, 1, "\\\\[a-zA-Z0-9_]+\\{([^}]+)\\}"}, | |
68 {-1, +1, 0, "\\\\[^ \t" CR2L "]+"}, | |
69 }; | |
70 | |
71 /* character placeholders */ | |
72 static struct placeholder { | |
73 char *s; /* the source character */ | |
74 char *d; /* the placeholder */ | |
75 int wid; /* the width of the placeholder */ | |
76 } placeholders[] = { | |
77 {"", "-", 1}, | |
78 {"", "-", 1}, | |
79 }; |