chore(mappings): add options to reflect wiki changes (#349)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
cb197fb606
commit
1e009822e4
@ -23,13 +23,14 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim):
|
|||||||
{
|
{
|
||||||
"yetone/avante.nvim",
|
"yetone/avante.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
|
lazy = false,
|
||||||
opts = {
|
opts = {
|
||||||
-- add any opts here
|
-- add any opts here
|
||||||
},
|
},
|
||||||
keys = { -- See https://github.com/yetone/avante.nvim/wiki#keymaps for more info
|
keys = {
|
||||||
{ "<leader>aa", function() require("avante.api").ask() end, desc = "avante: ask", mode = { "n", "v" } },
|
{ "<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>ar", function() require("avante.api").refresh() end, desc = "avante: refresh" },
|
||||||
{ "<leader>ae", function() require("avante.api").edit() end, desc = "avante: edit", mode = { "n", "v" } },
|
{ "<leader>ae", function() require("avante.api").edit() end, desc = "avante: edit", mode = "v" },
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"stevearc/dressing.nvim",
|
"stevearc/dressing.nvim",
|
||||||
@ -211,7 +212,7 @@ The following key bindings are available for use with `avante.nvim`:
|
|||||||
> [!NOTE]
|
> [!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.
|
> 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.
|
> In this case, user will be responsible for setting up their own. See [notes on keymaps](https://github.com/yetone/avante.nvim/wiki#keymaps-and-api-i-guess) for more details.
|
||||||
|
|
||||||
## Highlight Groups
|
## Highlight Groups
|
||||||
|
|
||||||
|
@ -66,10 +66,13 @@ M.defaults = {
|
|||||||
---Specify the behaviour of avante.nvim
|
---Specify the behaviour of avante.nvim
|
||||||
---1. auto_apply_diff_after_generation: Whether to automatically apply diff after LLM response.
|
---1. auto_apply_diff_after_generation: Whether to automatically apply diff after LLM response.
|
||||||
--- This would simulate similar behaviour to cursor. Default to false.
|
--- This would simulate similar behaviour to cursor. Default to false.
|
||||||
---2. auto_set_highlight_group: Whether to automatically set the highlight group for the current line. Default to true.
|
---2. auto_set_keymaps : Whether to automatically set the keymap for the current line. Default to true.
|
||||||
---3. support_paste_from_clipboard: Whether to support pasting image from clipboard. This will be determined automatically based whether img-clip is available or not.
|
--- Note that avante will safely set these keymap. See https://github.com/yetone/avante.nvim/wiki#keymaps-and-api-i-guess for more details.
|
||||||
|
---3. auto_set_highlight_group : Whether to automatically set the highlight group for the current line. Default to true.
|
||||||
|
---4. support_paste_from_clipboard : Whether to support pasting image from clipboard. This will be determined automatically based whether img-clip is available or not.
|
||||||
behaviour = {
|
behaviour = {
|
||||||
auto_set_highlight_group = true,
|
auto_set_highlight_group = true,
|
||||||
|
auto_set_keymaps = true,
|
||||||
auto_apply_diff_after_generation = false,
|
auto_apply_diff_after_generation = false,
|
||||||
support_paste_from_clipboard = false,
|
support_paste_from_clipboard = false,
|
||||||
},
|
},
|
||||||
|
@ -28,13 +28,6 @@ H.commands = function()
|
|||||||
cmd("Ask", function()
|
cmd("Ask", function()
|
||||||
M.ask()
|
M.ask()
|
||||||
end, { desc = "avante: ask AI for code suggestions" })
|
end, { desc = "avante: ask AI for code suggestions" })
|
||||||
cmd("Close", function()
|
|
||||||
local sidebar, _ = M._get()
|
|
||||||
if not sidebar then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
sidebar:close()
|
|
||||||
end, { desc = "avante: close chat window" })
|
|
||||||
cmd("Edit", function()
|
cmd("Edit", function()
|
||||||
M.edit()
|
M.edit()
|
||||||
end, { desc = "avante: edit selected block" })
|
end, { desc = "avante: edit selected block" })
|
||||||
@ -61,21 +54,23 @@ H.keymaps = function()
|
|||||||
M.toggle.hint()
|
M.toggle.hint()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Utils.safe_keymap_set({ "n", "v" }, Config.mappings.ask, function()
|
if Config.behaviour.auto_set_keymaps then
|
||||||
M.ask()
|
Utils.safe_keymap_set({ "n", "v" }, Config.mappings.ask, function()
|
||||||
end, { desc = "avante: ask" })
|
M.ask()
|
||||||
Utils.safe_keymap_set("v", Config.mappings.edit, function()
|
end, { desc = "avante: ask" })
|
||||||
M.edit()
|
Utils.safe_keymap_set("v", Config.mappings.edit, function()
|
||||||
end, { desc = "avante: edit" })
|
M.edit()
|
||||||
Utils.safe_keymap_set("n", Config.mappings.refresh, function()
|
end, { desc = "avante: edit" })
|
||||||
M.refresh()
|
Utils.safe_keymap_set("n", Config.mappings.refresh, function()
|
||||||
end, { desc = "avante: refresh" })
|
M.refresh()
|
||||||
Utils.safe_keymap_set("n", Config.mappings.toggle.debug, function()
|
end, { desc = "avante: refresh" })
|
||||||
M.toggle.debug()
|
Utils.safe_keymap_set("n", Config.mappings.toggle.debug, function()
|
||||||
end, { desc = "avante: toggle debug" })
|
M.toggle.debug()
|
||||||
Utils.safe_keymap_set("n", Config.mappings.toggle.hint, function()
|
end, { desc = "avante: toggle debug" })
|
||||||
M.toggle.hint()
|
Utils.safe_keymap_set("n", Config.mappings.toggle.hint, function()
|
||||||
end, { desc = "avante: toggle hint" })
|
M.toggle.hint()
|
||||||
|
end, { desc = "avante: toggle hint" })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@class ApiCaller
|
---@class ApiCaller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user