summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/hi.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/bin/hi.c b/bin/hi.c
index 463c4fcc..3f2d35cf 100644
--- a/bin/hi.c
+++ b/bin/hi.c
@@ -42,7 +42,9 @@ typedef unsigned Set;
 	X(Format)  \
 	X(Interp)  \
 	X(Comment) \
-	X(Todo)
+	X(Todo)    \
+	X(DiffOld) \
+	X(DiffNew)
 
 enum Class {
 #define X(class) class,
@@ -125,6 +127,14 @@ static const struct Syntax CSyntax[] = {
 };
 // }}}
 
+// diff syntax {{{
+static const struct Syntax DiffSyntax[] = {
+	{ Comment, .pattern = "^@@.*" },
+	{ DiffOld, .pattern = "^[-].*" },
+	{ DiffNew, .pattern = "^[+].*" },
+};
+// }}}
+
 // make syntax {{{
 #define MAKE_TARGET "[-./_[:alnum:]]+"
 static const struct Syntax MakeSyntax[] = {
@@ -272,6 +282,7 @@ static const struct Language {
 	size_t len;
 } Languages[] = {
 	{ "c",    "[.][chly]$", CSyntax, ARRAY_LEN(CSyntax) },
+	{ "diff", "[.](diff|patch)$", DiffSyntax, ARRAY_LEN(DiffSyntax) },
 	{ "make", "[.]mk$|^Makefile$", MakeSyntax, ARRAY_LEN(MakeSyntax) },
 	{ "mdoc", "[.][1-9]$", MdocSyntax, ARRAY_LEN(MdocSyntax) },
 	{ "rust", "[.]rs$", RustSyntax, ARRAY_LEN(RustSyntax) },
@@ -389,6 +400,8 @@ static const enum SGR ANSIStyle[ClassLen][3] = {
 	[Interp]  = { SGRYellow },
 	[Comment] = { SGRBlue },
 	[Todo]    = { SGRBlue, SGRBoldOn, SGRBoldOff },
+	[DiffOld] = { SGRRed },
+	[DiffNew] = { SGRGreen },
 };
 
 static void
@@ -495,14 +508,16 @@ static void htmlEscape(const char *str, size_t len) {
 }
 
 static const char *HTMLStyle[ClassLen] = {
-	[Keyword]  = "color: dimgray;",
-	[Macro]    = "color: green;",
-	[Tag]      = "color: inherit; text-decoration: underline;",
-	[String]   = "color: teal;",
-	[Format]   = "color: teal; font-weight: bold;",
-	[Interp]   = "color: olive;",
-	[Comment]  = "color: navy;",
-	[Todo]     = "color: navy; font-weight: bold;",
+	[Keyword] = "color: dimgray;",
+	[Macro]   = "color: green;",
+	[Tag]     = "color: inherit; text-decoration: underline;",
+	[String]  = "color: teal;",
+	[Format]  = "color: teal; font-weight: bold;",
+	[Interp]  = "color: olive;",
+	[Comment] = "color: navy;",
+	[Todo]    = "color: navy; font-weight: bold;",
+	[DiffOld] = "color: red;",
+	[DiffNew] = "color: green;",
 };
 
 static void htmlTabSize(const char *tab) {
run gitgutter eagerlyJune McEnroe 2013-05-15Remove tabularJune McEnroe 2013-05-15Use long names for all settingsJune McEnroe 2013-05-15Add vim-gitgutterJune McEnroe 2013-04-23Remove unused pluginsJune McEnroe 2013-04-23Switch to base16-default colorschemeJune McEnroe 2013-03-26Replace nerdcommenter with vim-commentaryJune McEnroe 2013-03-24Add paredit.vimJune McEnroe 2013-03-14Update base16-vimJune McEnroe It's still crap 2013-03-12Hide mode from below statuslineJune McEnroe 2013-03-12Switch to powerlineJune McEnroe Which I'm not going to bother configuring because it thinks it's all fancy and for other things that aren't Vim so it stores its config file in ~/.config which I keep in a different repo and I only want to use it for Vim so fuck you, Powerline. </rant> 2013-03-12Remove vim-powerlineJune McEnroe 2013-02-03Update base16 and refheapJune McEnroe 2013-02-03Ignore plugin/private.vimJune McEnroe 2012-09-29Disable GUI dialogsJune McEnroe