vi: exit if ex_init() fails
[neatvi.git] / conf.c
blobfd555db16dfc3fce3a663ba7db37e346304e7ede
1 #include <stdio.h>
2 #include "vi.h"
3 #include "conf.h"
5 char *conf_kmapalt(void)
7 return KMAPALT;
10 int conf_dirmark(int idx, char **pat, int *ctx, int *dir, int *grp)
12 if (idx < 0 || idx >= LEN(dirmarks))
13 return 1;
14 if (pat)
15 *pat = dirmarks[idx].pat;
16 if (ctx)
17 *ctx = dirmarks[idx].ctx;
18 if (dir)
19 *dir = dirmarks[idx].dir;
20 if (grp)
21 *grp = dirmarks[idx].grp;
22 return 0;
25 int conf_dircontext(int idx, char **pat, int *ctx)
27 if (idx < 0 || idx >= LEN(dircontexts))
28 return 1;
29 if (pat)
30 *pat = dircontexts[idx].pat;
31 if (ctx)
32 *ctx = dircontexts[idx].dir;
33 return 0;
36 int conf_placeholder(int idx, char **s, char **d, int *wid)
38 if (idx < 0 || idx >= LEN(placeholders))
39 return 1;
40 if (s)
41 *s = placeholders[idx].s;
42 if (d)
43 *d = placeholders[idx].d;
44 if (wid)
45 *wid = placeholders[idx].wid;
46 return 0;
49 int conf_highlight(int idx, char **ft, int **att, char **pat, int *end)
51 if (idx < 0 || idx >= LEN(highlights))
52 return 1;
53 if (ft)
54 *ft = highlights[idx].ft;
55 if (att)
56 *att = highlights[idx].att;
57 if (pat)
58 *pat = highlights[idx].pat;
59 if (end)
60 *end = highlights[idx].end;
61 return 0;
64 int conf_filetype(int idx, char **ft, char **pat)
66 if (idx < 0 || idx >= LEN(filetypes))
67 return 1;
68 if (ft)
69 *ft = filetypes[idx].ft;
70 if (pat)
71 *pat = filetypes[idx].pat;
72 return 0;
75 int conf_highlight_revdir(int *att)
77 *att = SYN_REVDIR;
78 return 0;