feat(mapping): plug and expose API (#346)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-08-28 23:56:00 -04:00
committed by GitHub
parent 8a683b053b
commit 2e6a26240e
5 changed files with 201 additions and 57 deletions

View File

@@ -26,6 +26,11 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim):
opts = {
-- add any opts here
},
keys = { -- See https://github.com/yetone/avante.nvim/wiki#keymaps for more info
{ "<leader>aa", function() require("avante.api").ask() end, desc = "avante: ask", mode = { "n", "v" } },
{ "<leader>ar", function() require("avante.api").refresh() end, desc = "avante: refresh", mode = "v" },
{ "<leader>ae", function() require("avante.api").edit() end, desc = "avante: edit", mode = { "n", "v" } },
},
dependencies = {
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
@@ -94,9 +99,6 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
max_tokens = 4096,
},
mappings = {
ask = "<leader>aa",
edit = "<leader>ae",
refresh = "<leader>ar",
--- @class AvanteConflictMappings
diff = {
ours = "co",
@@ -113,10 +115,6 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
normal = "<CR>",
insert = "<C-s>",
},
toggle = {
debug = "<leader>ad",
hint = "<leader>ah",
},
},
hints = { enabled = true },
windows = {
@@ -208,6 +206,11 @@ The following key bindings are available for use with `avante.nvim`:
| <kbd>[</kbd><kbd>[</kbd> | jump to previous codeblocks (results window) |
| <kbd>]</kbd><kbd>]</kbd> | jump to next codeblocks (results windows) |
> [!NOTE]
>
> If you are using `lazy.nvim`, then all keymap here will be safely set, meaning if `<leader>aa` is already binded, then avante.nvim won't bind this mapping.
> In this case, user will be responsible for setting up their own. See [notes on keymaps](https://github.com/yetone/avante.nvim/wiki#keymaps) for more details.
## Highlight Groups