Skip to content

Commit

Permalink
update git-linker conf
Browse files Browse the repository at this point in the history
1. Add configuration for azure devops
2. change the mappings slightly
  • Loading branch information
jdhao committed Aug 9, 2023
1 parent 855a88b commit 4a6379c
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions lua/config/git-linker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,36 @@ local keymap = vim.keymap
local gitlinker = require("gitlinker")

gitlinker.setup {
callbacks = {
["dev.azure.com"] = function(url_data)
vim.print(url_data)
local url = require"gitlinker.hosts".get_base_https_url(url_data)

if url_data.lstart then
if url_data.lend == nil then
url_data.lend = url_data.lstart
end
url = url .. "?path=/" .. url_data.file .. "&version=GC" .. url_data.rev .. "&line=" .. url_data.lstart .. "&lineEnd=" .. url_data.lend .. "&lineStartColumn=1" .. "&lineEndColumn=120"
end
return url
end
},
mappings = nil,
}

keymap.set({ "n", "v" }, "<leader>gl", "", {
keymap.set({ "n", "v" }, "<leader>gl", function()
local mode = string.lower(vim.fn.mode())
gitlinker.get_buf_range_url(mode)
end, {
silent = true,
desc = "get git permlink",
callback = function()
local mode = string.lower(vim.fn.mode())
gitlinker.get_buf_range_url(mode)
end,
})

keymap.set("n", "<leader>gb", "", {
keymap.set("n", "<leader>gb", function()
gitlinker.get_repo_url({
action_callback = gitlinker.actions.open_in_browser
})
end, {
silent = true,
desc = "browse repo in browser",
callback = function()
gitlinker.get_repo_url({
action_callback = gitlinker.actions.open_in_browser
})
end
})

0 comments on commit 4a6379c

Please sign in to comment.