Skip to content

Commit

Permalink
chore(nvim): Switch gitlinker.nvim config to declarative syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed May 23, 2024
1 parent d4f60d7 commit db5b0b5
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions nvim/lua/my/configure/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,35 @@ return {
{
'linrongbin16/gitlinker.nvim',
cmd = { 'GitLink' },
config = function()
require('gitlinker').setup({
action_callback = clipboard.copy,
router = {
browse = {
['gitlab%.1password%.io'] = function(data)
local url = string.format(
'https://gitlab.1password.io/%s/%s/-/blob/%s/%s',
data.org,
data.repo:gsub('%.git', ''),
data.current_branch,
data.file
)
clipboard.copy(url)
return url
end,
['^github%.com'] = function(data)
local url = string.format(
'https://github.com/%s/%s/blob/%s/%s',
data.org,
data.repo:gsub('%.git', ''),
data.current_branch,
data.file
)
clipboard.copy(url)
return url
end,
},
opts = {
action_callback = clipboard.copy,
router = {
browse = {
['gitlab%.1password%.io'] = function(data)
local url = string.format(
'https://gitlab.1password.io/%s/%s/-/blob/%s/%s',
data.org,
data.repo:gsub('%.git', ''),
data.current_branch,
data.file
)
clipboard.copy(url)
return url
end,
['^github%.com'] = function(data)
local url = string.format(
'https://github.com/%s/%s/blob/%s/%s',
data.org,
data.repo:gsub('%.git', ''),
data.current_branch,
data.file
)
clipboard.copy(url)
return url
end,
},
})
end,
},
},
keys = { { '<leader>gy', '<cmd>GitLink<cr>', desc = 'Copy GitHub link', silent = true } },
},
{
Expand Down

0 comments on commit db5b0b5

Please sign in to comment.