Skip to content

Commit

Permalink
red: diff syntax added
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeping committed Oct 23, 2023
1 parent f8efc16 commit 0acb4ea
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/lib/red/presets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ return {
{"%.go$", { ts = 8, spaces_tab = false, trim_spaces = true } },
{"%.py$", { ts = 4, spaces_tab = true, trim_spaces = true } },
{"%.md$", { ts = 2, spaces_tab = true, trim_spaces = true, syntax = "markdown" } },
{"%.diff$", { ts = 8, spaces_tab = false, trim_spaces = false, syntax = "diff" } },
}
52 changes: 52 additions & 0 deletions data/lib/red/syntax/diff.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
local scheme = require "red/syntax/scheme"

local col = {
col = scheme.default,
{
linestart = 'diff ',
stop = '\n',
col = scheme.number,
},
{
linestart = 'index ',
stop = '\n',
col = scheme.number,
},
{ -- section
linestart = '--- ',
stop = '\n',
col = scheme.lib,
},
{ -- section
linestart = '+++ ',
stop = '\n',
col = scheme.lib,
},
{ -- add
linestart = '+',
stop = '\n',
col = { 0, 190, 0 },
},
{ -- add
linestart = '>',
stop = '\n',
col = { 0, 190, 0 },
},
{ -- del
linestart = '-',
stop = '\n',
col = {255, 0, 0 },
},
{ -- del
linestart = '<',
stop = '\n',
col = {255, 0, 0 },
},
{
linestart = '@@ ',
stop = '\n',
col = scheme.string,
}
}

return col

0 comments on commit 0acb4ea

Please sign in to comment.