Skip to content

Commit 28eb977

Browse files
authored
feat(avante-nvim): Add Neotree shortcut (#1399)
* Avante: Neotree shortcut fix: The configuration in the README for Avante.nvim overrides the original shortcuts for neotree * Update init.lua(format) * Update init.lua(opts syntax)
1 parent f18ef3e commit 28eb977

File tree

1 file changed

+34
-0
lines changed
  • lua/astrocommunity/completion/avante-nvim

1 file changed

+34
-0
lines changed

lua/astrocommunity/completion/avante-nvim/init.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,39 @@ return {
7878
opts.filetypes = require("astrocore").list_insert_unique(opts.filetypes, { "Avante" })
7979
end,
8080
},
81+
{
82+
"nvim-neo-tree/neo-tree.nvim",
83+
optional = true,
84+
opts = {
85+
filesystem = {
86+
commands = {
87+
avante_add_files = function(state)
88+
local node = state.tree:get_node()
89+
local filepath = node:get_id()
90+
local relative_path = require("avante.utils").relative_path(filepath)
91+
92+
local sidebar = require("avante").get()
93+
94+
local open = sidebar:is_open()
95+
-- ensure avante sidebar is open
96+
if not open then
97+
require("avante.api").ask()
98+
sidebar = require("avante").get()
99+
end
100+
101+
sidebar.file_selector:add_selected_file(relative_path)
102+
103+
-- remove neo tree buffer
104+
if not open then sidebar.file_selector:remove_selected_file "neo-tree filesystem [1]" end
105+
end,
106+
},
107+
},
108+
window = {
109+
mappings = {
110+
["oa"] = "avante_add_files",
111+
},
112+
},
113+
},
114+
},
81115
},
82116
}

0 commit comments

Comments
 (0)