From 7ca4c173853f86de34f1f36bbb5b28e5b0682afd Mon Sep 17 00:00:00 2001
From: Christoph Koehler <christoph@zerodeviation.net>
Date: Sat, 5 Apr 2025 22:29:54 -0600
Subject: [PATCH] feat: add gitlinker

---
 docs/release-notes/rl-0.8.md                  |  2 ++
 modules/plugins/git/default.nix               |  2 ++
 modules/plugins/git/gitlinker-nvim/config.nix | 23 +++++++++++++++++++
 .../plugins/git/gitlinker-nvim/default.nix    |  6 +++++
 .../git/gitlinker-nvim/gitlinker-nvim.nix     | 13 +++++++++++
 npins/sources.json                            | 13 +++++++++++
 6 files changed, 59 insertions(+)
 create mode 100644 modules/plugins/git/gitlinker-nvim/config.nix
 create mode 100644 modules/plugins/git/gitlinker-nvim/default.nix
 create mode 100644 modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix

diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md
index 32460969..239f91b0 100644
--- a/docs/release-notes/rl-0.8.md
+++ b/docs/release-notes/rl-0.8.md
@@ -315,10 +315,12 @@
 [ckoehler](https://github.com/ckoehler):
 
 [flash.nvim]: https://github.com/folke/flash.nvim
+[gitlinker.nvim]: https://github.com/linrongbin16/gitlinker.nvim
 
 - Fix oil config referencing snacks
 - Add [flash.nvim] plugin to `vim.utility.motion.flash-nvim`
 - Fix default telescope ignore list entry for '.git/' to properly match
+- Add [gitlinker.nvim] plugin to `vim.git.gitlinker-nvim`
 
 [rrvsh](https://github.com/rrvsh):
 
diff --git a/modules/plugins/git/default.nix b/modules/plugins/git/default.nix
index 6ed92217..06c80f35 100644
--- a/modules/plugins/git/default.nix
+++ b/modules/plugins/git/default.nix
@@ -5,6 +5,7 @@ in {
     ./gitsigns
     ./vim-fugitive
     ./git-conflict
+    ./gitlinker-nvim
   ];
 
   options.vim.git = {
@@ -15,6 +16,7 @@ in {
       * gitsigns
       * vim-fugitive
       * git-conflict
+      * gitlinker-nvim
     '';
   };
 }
diff --git a/modules/plugins/git/gitlinker-nvim/config.nix b/modules/plugins/git/gitlinker-nvim/config.nix
new file mode 100644
index 00000000..d1104a28
--- /dev/null
+++ b/modules/plugins/git/gitlinker-nvim/config.nix
@@ -0,0 +1,23 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (lib.modules) mkIf;
+
+  cfg = config.vim.git.gitlinker-nvim;
+in {
+  config = mkIf cfg.enable {
+    vim = {
+      startPlugins = ["gitlinker-nvim"];
+      lazy.plugins = {
+        "gitlinker-nvim" = {
+          package = "gitlinker-nvim";
+          setupModule = "gitlinker";
+          inherit (cfg) setupOpts;
+          cmd = ["GitLink"];
+        };
+      };
+    };
+  };
+}
diff --git a/modules/plugins/git/gitlinker-nvim/default.nix b/modules/plugins/git/gitlinker-nvim/default.nix
new file mode 100644
index 00000000..389b7a55
--- /dev/null
+++ b/modules/plugins/git/gitlinker-nvim/default.nix
@@ -0,0 +1,6 @@
+{
+  imports = [
+    ./config.nix
+    ./gitlinker-nvim.nix
+  ];
+}
diff --git a/modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix b/modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
new file mode 100644
index 00000000..f315e5f9
--- /dev/null
+++ b/modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
@@ -0,0 +1,13 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (lib.options) mkEnableOption;
+  inherit (lib.nvim.types) mkPluginSetupOption;
+in {
+  options.vim.git.gitlinker-nvim = {
+    enable = mkEnableOption "gitlinker-nvim" // {default = config.vim.git.enable;};
+    setupOpts = mkPluginSetupOption "gitlinker-nvim" {};
+  };
+}
diff --git a/npins/sources.json b/npins/sources.json
index 140b3b24..c3ec23b1 100644
--- a/npins/sources.json
+++ b/npins/sources.json
@@ -562,6 +562,19 @@
       "url": "https://github.com/projekt0n/github-nvim-theme/archive/c106c9472154d6b2c74b74565616b877ae8ed31d.tar.gz",
       "hash": "1w7lz4bgfm8hq1mir4hcr8ik585d4l4w7bjl8yl3g3zklj8223pw"
     },
+    "gitlinker-nvim": {
+      "type": "Git",
+      "repository": {
+        "type": "GitHub",
+        "owner": "linrongbin16",
+        "repo": "gitlinker.nvim"
+      },
+      "branch": "master",
+      "submodules": false,
+      "revision": "23982c86f50a9c3f4bc531d41b7a4a68ddd12355",
+      "url": "https://github.com/linrongbin16/gitlinker.nvim/archive/23982c86f50a9c3f4bc531d41b7a4a68ddd12355.tar.gz",
+      "hash": "1kz3gpdysxzpb27izhq0jgk59xw01mmnfvg5yrqvxnfhyjblxvqh"
+    },
     "gitsigns-nvim": {
       "type": "Git",
       "repository": {