Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lua/gitlinker/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 6 additions & 0 deletions lua/gitlinker/opts.lua
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
Expand Down