diff --git a/README.md b/README.md index b40bfbc..ddb5404 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ in `setup()` function. ## Configuration -```lua +````lua require('gitlinker').setup({ -- print message in command line message = true, @@ -116,16 +116,16 @@ require('gitlinker').setup({ -- regex pattern based rules pattern_rules = { { - ["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/", - ["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/", - ["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/", - ["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/", + ["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/", + ["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://github.%1/%2/%3/blob/", + ["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/", + ["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)%.git$"] = "https://gitlab.%1/%2/%3/blob/", }, { - ["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/", - ["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/", - ["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/", - ["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/", + ["^git@github%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/", + ["^https?://github%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://github.%1/%2/%3/blob/", + ["^git@gitlab%.([_%.%-%w]+):([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/", + ["^https?://gitlab%.([_%.%-%w]+)/([%.%-%w]+)/([_%.%-%w]+)$"] = "https://gitlab.%1/%2/%3/blob/", }, }, @@ -171,4 +171,4 @@ require('gitlinker').setup({ -- write logs to file file_log = false, }) -``` +```` diff --git a/lua/gitlinker/test/test_rules.lua b/lua/gitlinker/test/test_rules.lua index 374339d..66072aa 100644 --- a/lua/gitlinker/test/test_rules.lua +++ b/lua/gitlinker/test/test_rules.lua @@ -66,6 +66,16 @@ local test_cases = { "https://gitlab.com/ruifm/gitlinker.nvim", "https://gitlab.com/ruifm/gitlinker.nvim/blob/", }, + -- [13] + { + "git@github.enterprise.io:organization/repository_with_single_dash1", + "https://github.enterprise.io/organization/repository_with_single_dash1/blob/", + }, + -- [14] + { + "https://github.enterprise.io/organization/repository____multiple___dash2.git", + "https://github.enterprise.io/organization/repository____multiple___dash2/blob/", + }, } for i, case in ipairs(test_cases) do