aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_diff.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-03-03 14:21:04 -0400
committerjgmdev <jgmdev@gmail.com>2022-03-03 14:21:04 -0400
commitb198c3b9e01257b375242b3aea3ac4fa4d3ba4ab (patch)
tree4085ddba0e7c76ff857c4c6154c1d0abdf9bcb2b /plugins/language_diff.lua
parent9ff12f61d86ed8d33471199ce6705dd15f9a5af4 (diff)
downloadlite-xl-plugins-b198c3b9e01257b375242b3aea3ac4fa4d3ba4ab.tar.gz
lite-xl-plugins-b198c3b9e01257b375242b3aea3ac4fa4d3ba4ab.zip
language_diff: following @Guldoman feedback simplified regex and match the name too on emails
Diffstat (limited to 'plugins/language_diff.lua')
-rw-r--r--plugins/language_diff.lua40
1 files changed, 20 insertions, 20 deletions
diff --git a/plugins/language_diff.lua b/plugins/language_diff.lua
index fd5406c..7e17d80 100644
--- a/plugins/language_diff.lua
+++ b/plugins/language_diff.lua
@@ -13,46 +13,46 @@ syntax.add {
headers = "^diff ",
patterns = {
-- Method the patch was generated with and source/target files
- { regex = "^diff .+\n$", type = "function" },
+ { regex = "^diff .+", type = "function" },
-- Seen for changing the file permissions
- { regex = "^new .+\n$", type = "comment" },
+ { regex = "^new .+", type = "comment" },
-- Usually holds starting and ending commit
- { regex = "^index .+\n$", type = "comment" },
+ { regex = "^index .+", type = "comment" },
-- Position to patch
{
- pattern = "@@.-@@ ().+\n", --with heading
+ pattern = "@@.-@@ ().+", --with heading
type = { "number", "string" }
},
{
- regex = "^@@ [\\d,\\-\\+ ]+ @@\n$", --wihtout heading
+ regex = "^@@ [\\d,\\-\\+ ]+ @@\n", --wihtout heading
type = "number"
},
-- Other position to patch formats
{
- regex = "^\\-{3} [\\d]+,[\\d]+ \\-{4}\n$",
+ regex = "^-{3} [\\d]+,[\\d]+ \\-{4}\n",
type = "number"
},
{
- regex = "^\\*{3} [\\d]+,[\\d]+ \\*{4}\n$",
+ regex = "^\\*{3} [\\d]+,[\\d]+ \\*{4}\n",
type = "number"
},
-- Source and target file
- { regex = "^-{3} .+\n$", type = "keyword" },
- { regex = "^\\+{3} .+\n$", type = "keyword" },
+ { regex = "^-{3} .+", type = "keyword" },
+ { regex = "^\\+{3} .+", type = "keyword" },
-- Rarely used source file indicator
- { regex = "^\\*{3} .+\n$", type = "keyword" },
+ { regex = "^\\*{3} .+", type = "keyword" },
-- git patches seem to add 3 dashes to separate message from changed files
- { regex = "^\\-{3}\n$", type = "normal" },
+ { regex = "^-{3}\n", type = "normal" },
-- Addition and deletion of lines
- { regex = "^\\-.*\n$", type = "diff_del" },
- { regex = "^\\+.*\n$", type = "diff_add" },
- { regex = "^<.*\n$", type = "diff_del" },
- { regex = "^>.*\n$", type = "diff_add" },
+ { regex = "^-.*", type = "diff_del" },
+ { regex = "^\\+.*", type = "diff_add" },
+ { regex = "^<.*", type = "diff_del" },
+ { regex = "^>.*", type = "diff_add" },
-- Change between two lines
- { regex = "^!.*\n$", type = "number" },
+ { regex = "^!.*", type = "number" },
-- Stuff usually found on a authored patch heading
{
- pattern = "From ()[a-fA-F0-9]+ ().+\n",
+ pattern = "From ()[a-fA-F0-9]+ ().+",
type = { "keyword", "number", "string" }
},
{ regex = "^[a-zA-Z\\-]+: ", type = "keyword" },
@@ -62,9 +62,9 @@ syntax.add {
{ regex = "[\\d]+ deletions?\\(\\-\\)", type = "diff_del" },
-- Match e-mail
{
- regex = "<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+>\n",
- type = "keyword2"
- }
+ pattern = ".*()<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+%.[a-zA-Z0-9-.]+>",
+ type = {"string", "keyword2"}
+ },
},
symbols = {}
}