From 72b0b9a47e512f06f099028bd5ee9c0ba6be681f Mon Sep 17 00:00:00 2001 From: Athanasios Douitsis <65439+aduitsis@users.noreply.github.com> Date: Wed, 18 Feb 2026 02:24:26 +0200 Subject: [PATCH 1/2] Add git_timeout option to defaults Added git_timeout option to configure command timeout. --- lua/gitlinker/opts.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/gitlinker/opts.lua b/lua/gitlinker/opts.lua index ad58dd18..89461599 100644 --- a/lua/gitlinker/opts.lua +++ b/lua/gitlinker/opts.lua @@ -1,10 +1,13 @@ local M = {} +local git = require("gitlinker.git") + local defaults = { remote = "origin", -- force the use of a specific remote add_current_line_on_normal_mode = true, -- if true adds the line nr in the url for normal mode action_callback = require("gitlinker.actions").copy_to_clipboard, -- callback for what to do with the url print_url = true, -- print the url after action + git_timeout = 5000, -- by default, any git command after 5 seconds. } local opts @@ -14,6 +17,9 @@ function M.setup(user_opts) opts = vim.tbl_deep_extend("force", {}, defaults) end opts = vim.tbl_deep_extend("force", opts, user_opts or {}) + if opts.git_timeout then + git.git_timeout = opts.git_timeout + end end function M.get() From 9dc3b7d102a854cd3af7fdd16fe9480c7abc17a7 Mon Sep 17 00:00:00 2001 From: Athanasios Douitsis <65439+aduitsis@users.noreply.github.com> Date: Wed, 18 Feb 2026 02:25:18 +0200 Subject: [PATCH 2/2] Set git timeout to 5000 milliseconds --- lua/gitlinker/git.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/gitlinker/git.lua b/lua/gitlinker/git.lua index 43522e41..a1434967 100644 --- a/lua/gitlinker/git.lua +++ b/lua/gitlinker/git.lua @@ -3,6 +3,8 @@ local M = {} local job = require("plenary.job") local path = require("plenary.path") +M.git_timeout = 5000 + -- wrap the git command to do the right thing always local function git(args, cwd) local output @@ -14,7 +16,7 @@ local function git(args, cwd) p:after_success(function(j) output = j:result() end) - p:sync() + p:sync(M.timeout) return output or {} end