From b6d118ed751fa5d02ea8012c0671b948908bc30e Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.uk>
Date: Tue, 5 Sep 2023 07:34:17 +0100
Subject: [PATCH] feat(nvim): re-add projectionist.vim

Re-add `projectionist.vim` with a minimal configuration for setting the
alternate file in basic PHP library or TypeScript projects.
---
 config/neovim/after/plugin/projectionist.lua | 42 ++++++++++++++++++++
 system/shared/home-manager.nix               |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 config/neovim/after/plugin/projectionist.lua

diff --git a/config/neovim/after/plugin/projectionist.lua b/config/neovim/after/plugin/projectionist.lua
new file mode 100644
index 00000000..681cf4b5
--- /dev/null
+++ b/config/neovim/after/plugin/projectionist.lua
@@ -0,0 +1,42 @@
+vim.g.projectionist_heuristics = {
+  ["composer.json"] = {
+    ["src/*.php"] = {
+      type = "source",
+      alternate = "tests/{}Test.php",
+    },
+
+    ["src/Controller/*.php"] = {
+      type = "controller",
+    },
+
+    ["src/Model/*.php"] = {
+      type = "model",
+    },
+
+    ["src/Service/*.php"] = {
+      type = "service",
+    },
+
+    ["tests/*Test.php"] = {
+      type = "test",
+      alternate = "src/{}.php",
+    },
+  },
+
+  ["package.json"] = {
+    ["src/*.ts"] = {
+      type = "source",
+      alternate = "tests/{}.test.ts",
+    },
+
+    ["src/*.service.ts"] = {
+      type = "source",
+      alternate = "tests/{}.test.ts",
+    },
+
+    ["tests/*.test.ts"] = {
+      type = "test",
+      alternate = "src/{}.ts",
+    },
+  },
+}
diff --git a/system/shared/home-manager.nix b/system/shared/home-manager.nix
index 1078226b..6ae83cdf 100644
--- a/system/shared/home-manager.nix
+++ b/system/shared/home-manager.nix
@@ -532,6 +532,7 @@ in
       vimPlugins.vim-obsession
       vimPlugins.vim-pasta
       vimPlugins.vim-polyglot
+      vimPlugins.vim-projectionist
       vimPlugins.vim-repeat
       vimPlugins.vim-sleuth
       vimPlugins.vim-sort-motion