From 4054973b3b60310ac6957e413fc38d1658f882ce Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 9 Jan 2025 19:19:36 -0600 Subject: [PATCH] vimPlugins.aider-nvim: fix patch --- .../editors/vim/plugins/overrides.nix | 11 +++----- .../vim/plugins/patches/aider-nvim/bin.patch | 15 +++++++++++ .../patches/aider.nvim/fix-paths.patch | 26 ------------------- 3 files changed, 19 insertions(+), 33 deletions(-) create mode 100644 pkgs/applications/editors/vim/plugins/patches/aider-nvim/bin.patch delete mode 100644 pkgs/applications/editors/vim/plugins/patches/aider.nvim/fix-paths.patch diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index c84d0e792ad0..adf2f3385166 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -10,6 +10,7 @@ fetchpatch, fetchurl, neovimUtils, + replaceVars, substituteAll, # Language dependencies fetchYarnDeps, @@ -2593,13 +2594,9 @@ in }; aider-nvim = super.aider-nvim.overrideAttrs { - patches = [ ./patches/aider.nvim/fix-paths.patch ]; - - postPatch = '' - substituteInPlace lua/aider.lua --replace-fail '@aider@' ${aider-chat}/bin/aider - substituteInPlace lua/helpers.lua --replace-fail '@aider@' ${aider-chat}/bin/aider - ''; - nvimRequireCheck = "aider"; + patches = [ + (replaceVars ./patches/aider-nvim/bin.patch { aider = lib.getExe' aider-chat "aider"; }) + ]; }; refactoring-nvim = super.refactoring-nvim.overrideAttrs { diff --git a/pkgs/applications/editors/vim/plugins/patches/aider-nvim/bin.patch b/pkgs/applications/editors/vim/plugins/patches/aider-nvim/bin.patch new file mode 100644 index 000000000000..269c588cb6fc --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/patches/aider-nvim/bin.patch @@ -0,0 +1,15 @@ +diff --git a/lua/aider.lua b/lua/aider.lua +index 98b5071..589b06d 100644 +--- a/lua/aider.lua ++++ b/lua/aider.lua +@@ -61,9 +61,9 @@ function M.AiderOpen(args, window_type) + log("Existing aider buffer found, opening in new window") + helpers.open_buffer_in_new_window(window_type, M.aider_buf) + else + log("No existing aider buffer, creating new one") +- local command = "aider " .. (args or "") ++ local command = "@aider@ " .. (args or "") + log("Opening window with type: " .. window_type) + helpers.open_window(window_type) + log("Adding buffers to command") + command = helpers.add_buffers_to_command(command, is_valid_buffer) diff --git a/pkgs/applications/editors/vim/plugins/patches/aider.nvim/fix-paths.patch b/pkgs/applications/editors/vim/plugins/patches/aider.nvim/fix-paths.patch deleted file mode 100644 index 63995f0636dd..000000000000 --- a/pkgs/applications/editors/vim/plugins/patches/aider.nvim/fix-paths.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/lua/aider.lua b/lua/aider.lua -index 38db0d1..d1ad6d5 100644 ---- a/lua/aider.lua -+++ b/lua/aider.lua -@@ -26,7 +26,7 @@ function M.AiderOpen(args, window_type) - if M.aider_buf and vim.api.nvim_buf_is_valid(M.aider_buf) then - helpers.open_buffer_in_new_window(window_type, M.aider_buf) - else -- command = 'aider ' .. (args or '') -+ command = '@aider@ ' .. (args or '') - helpers.open_window(window_type) - command = helpers.add_buffers_to_command(command) - M.aider_job_id = vim.fn.termopen(command, {on_exit = OnExit}) -diff --git a/lua/helpers.lua b/lua/helpers.lua -index 152182b..aa21584 100644 ---- a/lua/helpers.lua -+++ b/lua/helpers.lua -@@ -63,7 +63,7 @@ end - - local function build_background_command(args, prompt) - prompt = prompt or "Complete as many todo items as you can and remove the comment for any item you complete." -- local command = 'aider --msg "' .. prompt .. '" ' .. (args or '') -+ local command = '@aider@ --msg "' .. prompt .. '" ' .. (args or '') - command = add_buffers_to_command(command) - return command - end