From 8191b42d7e58aaa5a6234c54c7fbc9cf675925f7 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:59:40 +0300 Subject: [PATCH] feat(lazygit): add user extensible capability for `M.remote_patterns` --- lua/lazyvim/config/options.lua | 7 +++++++ lua/lazyvim/util/lazygit.lua | 2 ++ 2 files changed, 9 insertions(+) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 3ad70c16..9e5c510c 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -18,6 +18,13 @@ vim.g.lazyvim_picker = "auto" -- * a function with signature `function(buf) -> string|string[]` vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" } +-- You can use this to extend the patterns used by `LazyVim.lazygit.browse` +-- It should be a list of tables with two string patterns, one for the original +-- and one for the replacement +-- vim.g.lazygit_remote_patterns = { +-- { "^ssh://.*@(.*)$", "https://%1" }, +-- } + -- LazyVim automatically configures lazygit: -- * theme, based on the active colorscheme. -- * editPreset to nvim-remote diff --git a/lua/lazyvim/util/lazygit.lua b/lua/lazyvim/util/lazygit.lua index ff96c85c..2a8d9fe8 100644 --- a/lua/lazyvim/util/lazygit.lua +++ b/lua/lazyvim/util/lazygit.lua @@ -177,6 +177,8 @@ M.remote_patterns = { { "%.git$" , "" }, } +M.remote_patterns = vim.list_extend(M.remote_patterns, vim.g.lazygit_remote_patterns or {}) + ---@param remote string function M.get_url(remote) local ret = remote