tex: add support for hl, highlight option - neatvi - [fork] simple vi-type edit… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 9f5b9af976acf7fb6f88d89e3ec5a6fb1c649c4a | |
parent 9dc503d43138d509a65cda2a7912724d9c0d8e15 | |
Author: Peter Aronoff <[email protected]> | |
Date: Sat, 27 Jun 2015 07:50:26 -0400 | |
ex: add support for hl, highlight option | |
This option allows users to easily set or unset syntax highlighting. | |
Diffstat: | |
M README | 4 ++++ | |
M ex.c | 4 +++- | |
M vi.h | 1 + | |
3 files changed, 8 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/README b/README | |
t@@ -33,3 +33,7 @@ aw, autowrite | |
ic, ignorecase | |
As in vi(1). | |
+ | |
+hl, highlight | |
+ If set (default), text will receive syntax highlighting based on the | |
+ rules in conf.h. | |
diff --git a/ex.c b/ex.c | |
t@@ -13,6 +13,7 @@ int xvis; /* visual mode */ | |
int xai = 1; /* autoindent option */ | |
int xic = 1; /* ignorecase option */ | |
int xaw; /* autowrite option */ | |
+int xhl = 1; /* syntax highlight option */ | |
int xled = 1; /* use the line editor */ | |
int xdir = +1; /* current direction context */ | |
int xshape = 1; /* perform letter shaping */ | |
t@@ -89,7 +90,7 @@ struct lbuf *ex_lbuf(void) | |
char *ex_filetype(void) | |
{ | |
- return bufs[0].ft; | |
+ return xhl ? bufs[0].ft : ""; | |
} | |
/* read ex command location */ | |
t@@ -680,6 +681,7 @@ static struct option { | |
{"td", "textdirection", &xdir}, | |
{"shape", "shape", &xshape}, | |
{"order", "xorder", &xorder}, | |
+ {"hl", "highlight", &xhl}, | |
}; | |
static char *cutword(char *s, char *d) | |
diff --git a/vi.h b/vi.h | |
t@@ -190,6 +190,7 @@ extern int xai; | |
extern int xdir; | |
extern int xshape; | |
extern int xorder; | |
+extern int xhl; | |
#define EXLEN 512 /* ex line length */ | |