From db5b0b5070c41d25f35a19f74ced5e2a993c300f Mon Sep 17 00:00:00 2001 From: Mat Jones Date: Thu, 23 May 2024 14:19:32 -0400 Subject: [PATCH] chore(nvim): Switch gitlinker.nvim config to declarative syntax --- nvim/lua/my/configure/git.lua | 58 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/nvim/lua/my/configure/git.lua b/nvim/lua/my/configure/git.lua index 2fddcd14..cfb707b2 100644 --- a/nvim/lua/my/configure/git.lua +++ b/nvim/lua/my/configure/git.lua @@ -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 = { { 'gy', 'GitLink', desc = 'Copy GitHub link', silent = true } }, }, {