1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

plugins/gitlinker: migrate to mkNeovimPlugin

This commit is contained in:
Gaetan Lepage 2025-10-12 11:42:12 +02:00 committed by Gaétan Lepage
parent a830246ed9
commit d5f23804b4
3 changed files with 167 additions and 123 deletions

View file

@ -1,30 +1,54 @@
{ lib, ... }:
{
empty = {
plugins.gitlinker.enable = true;
};
example = {
plugins.gitlinker = {
enable = true;
settings = {
opts = {
action_callback = lib.nixvim.mkRaw ''
function(url)
-- yank to unnamed register
vim.api.nvim_command("let @\" = '" .. url .. "'")
-- copy to the system clipboard using OSC52
vim.fn.OSCYankString(url)
end
'';
print_url = false;
};
};
};
};
defaults = {
plugins.gitlinker = {
enable = true;
remote = null;
addCurrentLineOnNormalMode = true;
actionCallback = "copy_to_clipboard";
printUrl = true;
mappings = "<leader>gy";
callbacks = {
"github.com" = "get_github_type_url";
"gitlab.com" = "get_gitlab_type_url";
"try.gitea.io" = "get_gitea_type_url";
"codeberg.org" = "get_gitea_type_url";
"bitbucket.org" = "get_bitbucket_type_url";
"try.gogs.io" = "get_gogs_type_url";
"git.sr.ht" = "get_srht_type_url";
"git.launchpad.net" = "get_launchpad_type_url";
"repo.or.cz" = "get_repoorcz_type_url";
"git.kernel.org" = "get_cgit_type_url";
"git.savannah.gnu.org" = "get_cgit_type_url";
settings = {
opts = {
remote = null;
add_current_line_on_normal_mode = true;
action_callback = lib.nixvim.mkRaw "require('gitlinker.actions').copy_to_clipboard";
print_url = true;
mappings = "<leader>gy";
};
callbacks = {
"github.com" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_github_type_url";
"gitlab.com" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_gitlab_type_url";
"try.gitea.io" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_gitea_type_url";
"codeberg.org" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_gitea_type_url";
"bitbucket.org" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_bitbucket_type_url";
"try.gogs.io" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_gogs_type_url";
"git.sr.ht" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_srht_type_url";
"git.launchpad.net" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_launchpad_type_url";
"repo.or.cz" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_repoorcz_type_url";
"git.kernel.org" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_cgit_type_url";
"git.savannah.gnu.org" = lib.nixvim.mkRaw "require('gitlinker.hosts').get_cgit_type_url";
};
};
};
};