aider.nvim icon indicating copy to clipboard operation
aider.nvim copied to clipboard

LazyVim

Open jontstaz opened this issue 2 years ago • 10 comments

Hi,

Is it possible to use this plugin with LazyVim? I see you have 3 methods listed in the readme but noticed it's lacking LazyVim which is what I and many others use for plugin management. I had a quick try at getting it to work with no luck.

jontstaz avatar Oct 22 '23 16:10 jontstaz

try this with the default LazyVim plugin setup style e.g. in lua/plugins/aider.lua

return {
	"joshuavial/aider.nvim",

	opts = {
		-- auto_manage_context = false,
		default_bindings = false,
	},

	keys = function()
		return {
			{
				"<leader>ao",
				"<cmd>lua AiderOpen()<cr>i",
				desc = "Aider Open",
			},
			{
				"<leader>ab",
				"<cmd>lua AiderBackground()<cr>",
				desc = "Aider Background",
				-- defaults to message "Complete as many todo items as you can and remove the comment for any item you complete."
			},
		}
	end,
}

dhax avatar Oct 22 '23 22:10 dhax

Great thank you, that works. However when I run <leader>ao and Aider opens up, it weirdly creates 3 empty files: [1000], neo-tree and filesystem. Is that normal?

jontstaz avatar Oct 23 '23 03:10 jontstaz

no, I don't get those other files.

dhax avatar Oct 23 '23 21:10 dhax

It appears that this no longer works as intended. I've manged to put together:

return {
  "joshuavial/aider.nvim",
  config = function()
    require("aider").setup({
      auto_manage_context = true,
      default_bindings = true,
    })
  end,
  keys = {
    {
      "<leader>oa",
      function()
        require("aider").AiderOpen()
      end,
      desc = "Aider Open",
    },
    {
      "<leader>ob",
      function()
        require("aider").AiderBackground()
      end,
      desc = "Aider Background",
    },
  },
}

after some troubleshooting under aider.lua in the plugins folder (Lazyvim the distro, mind you, not lazy.nvim.) The behavior I get from this (after adding the auto_manage_context and default_bindings fields to the .setup block, originally i didn't error out but i didn't get any behavior) is that the window flashes open in a split to the right for just a moment, the gitignore and neoconf get created, but immediately closes with error code 127 when i run in the background. Any ideas about what's going on? I'm relatively new to vim/Lazyvim/lua but pretty familiar with aider otherwise.

twilwa avatar Apr 01 '24 19:04 twilwa

no idea, sry, currently running the same config as I posted above with latest LazyVim distro without problems.

dhax avatar Apr 05 '24 16:04 dhax

return { "joshuavial/aider.nvim", config = function() require("aider").setup({ auto_manage_context = true, default_bindings = true, }) end, keys = { { "oa", function() require("aider").AiderOpen() end, desc = "Aider Open", }, { "ob", function() require("aider").AiderBackground() end, desc = "Aider Background", }, }, }

I confirm this is working fine for me to install on lazy vim

thiswillbeyourgithub avatar Jun 11 '24 10:06 thiswillbeyourgithub

Great thank you, that works. However when I run <leader>ao and Aider opens up, it weirdly creates 3 empty files: [1000], neo-tree and filesystem. Is that normal?

Did you manage to fix this issue?

imxw avatar Jul 03 '24 05:07 imxw

the window flashes open in a split to the right for just a moment, the gitignore and neoconf get created, but immediately closes with error code 127 when i run in the background

I have the same issue. Did you ever get it solved @twilwa?

jondkinney avatar Jul 26 '24 21:07 jondkinney

Lazy is using "old" which-key mappings, I've ended splitting the keys = into:

config = function() 
    requiere("which-key").add({.....})  -- instead of .register which is lazy defaults
end

aemonge avatar Aug 19 '24 15:08 aemonge

the window flashes open in a split to the right for just a moment, the gitignore and neoconf get created, but immediately closes with error code 127 when i run in the background

I have the same issue. Did you ever get it solved @twilwa?

It's been a while, but I beleive the issue was something to do with my API key not being set as an env var, so verify that (as well as making sure that the venv your aider is starting from has the same env var) first.

twilwa avatar Sep 20 '24 21:09 twilwa

I've pushed up a new version which should work fine with lazy now

joshuavial avatar Jan 05 '25 11:01 joshuavial