From 5f35a2bdc082bdc11756eb6a274c5e68da7a0db0 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 23 Jun 2024 05:53:06 -0500 Subject: [PATCH] fix(nvim): add Gitlinker support for `gitea` --- .../dots/.config/nvim/lua/plugins/configs/git.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/git.lua b/users/price/dots/.config/nvim/lua/plugins/configs/git.lua index 3fe84a4a..b7b57351 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/git.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/git.lua @@ -48,12 +48,13 @@ return { return string.len(s) >= string.len(t) and string.sub(s, #s - #t + 1) == t end - --- @param lk gitlinker.Linker - local gitlab_orion_router = function(type) + local gitea_router = function(type) return function(lk) local builder = "https://" .. lk.host .. "/" + .. lk.org + .. "/" .. (string_endswith(lk.repo, ".git") and lk.repo:sub(1, #lk.repo - 4) or lk.repo) .. "/" .. type @@ -65,7 +66,7 @@ return { .. lk.lstart if lk.lend > lk.lstart then - builder = builder .. "-" .. lk.lend + builder = builder .. "-L" .. lk.lend end return builder end @@ -73,10 +74,10 @@ return { return { router = { browse = { - ["^gitlab%.orion%-technologies%.io"] = gitlab_orion_router("blob"), + ["^git%.orion%-technologies%.io"] = gitea_router("src"), }, blame = { - ["^gitlab%.orion%-technologies%.io"] = gitlab_orion_router("blame"), + ["^git%.orion%-technologies%.io"] = gitea_router("blame/commit"), }, }, }