From 9c6a2f69f02acb4a5c5a51a2d9109b411821e529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Fri, 26 Jan 2024 22:02:25 +0100 Subject: [PATCH] vim/git: Use gitlinker --- hm/vim/git.nix | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/hm/vim/git.nix b/hm/vim/git.nix index 7c8706f..bd6fa9d 100644 --- a/hm/vim/git.nix +++ b/hm/vim/git.nix @@ -2,26 +2,30 @@ { config = { programs.nixvim = { - extraConfigVim = '' - let g:fugitive_gitlab_domains = [${ - lib.strings.concatStringsSep ", " ( - map (d: "'${d}'") config.frogeye.vim.fugitive.gitlab_domains - )}] - ''; - extraPlugins = with pkgs.vimPlugins; [ - fugitive-gitlab-vim # Open files in GitLab - # TODO Investigate gitlinker instead + keymaps = [ + { + mode = [ "n" ]; + key = "gG"; + action = ''lua require"gitlinker".get_buf_range_url("n")''; + } + { + mode = [ "v" ]; + key = "gG"; + action = ''lua require"gitlinker".get_buf_range_url("v")''; + } ]; plugins = { fugitive.enable = true; # Git basics gitsigns.enable = true; # Show changed lines in the gutter + gitlinker = { + enable = true; # Copy URL of forge corresponding to cursor + callbacks = { + "code.techinc.nl" = "get_gitea_type_url"; + "git.frogeye.fr" = "get_gitea_type_url"; + }; + mappings = null; # This option doesn't work, hence manual mappings + }; }; }; }; - options.frogeye.vim.fugitive = { - gitlab_domains = lib.mkOption { - default = { }; - type = lib.types.listOf lib.types.str; - }; - }; }