feat(file_selector): add intergration with nvim-tree.lua (#1987)

Co-authored-by: doodleEsc <cokie@foxmail.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
doodleEsc
2025-05-06 00:06:41 +08:00
committed by GitHub
parent e21f1f07bd
commit 0b78b58760
5 changed files with 177 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
</a>
### [Warp, the intelligent terminal for developers](https://www.warp.dev/avantenvim)
[Available for MacOS, Linux, & Windows](https://www.warp.dev/avantenvim)<br>
</div>
@@ -954,6 +955,43 @@ If you have the following structure:
>
> `*.avanterules` is a jinja template file, in which will be rendered using [minijinja](https://github.com/mitsuhiko/minijinja). See [templates](https://github.com/yetone/avante.nvim/blob/main/lua/avante/templates) for example on how to extend current templates.
## Integration
Avante.nvim can be extended to work with other plugins by using its extension modules. Below is an example of integrating Avante with [`nvim-tree`](https://github.com/nvim-tree/nvim-tree.lua), allowing you to select or deselect files directly from the NvimTree UI:
```lua
{
"yetone/avante.nvim",
event = "VeryLazy",
keys = {
{
"<leader>a+",
function()
local tree_ext = require("avante.extensions.nvim_tree")
tree_ext.add_file()
end,
desc = "Select file in NvimTree",
ft = "NvimTree",
},
{
"<leader>a-",
function()
local tree_ext = require("avante.extensions.nvim_tree")
tree_ext.remove_file()
end,
desc = "Deselect file in NvimTree",
ft = "NvimTree",
},
},
opts = {
--- other configurations
selector = {
exclude_auto_select = { "NvimTree" },
},
},
}
```
## TODOs
- [x] Chat with current file