fix: remove sidebar.close_from_input default keybinding (#1536)
* Remove <c-d> from default insert mode keybinding * Check `close_from_input ~= nil` before keymap * Default `close_from_input` to `nil` * Update README.md keybinding defaults * Try to pass type check
This commit is contained in:
@@ -349,8 +349,14 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
||||
sidebar = {
|
||||
apply_all = "A",
|
||||
apply_cursor = "a",
|
||||
retry_user_request = "r",
|
||||
edit_user_request = "e",
|
||||
switch_windows = "<Tab>",
|
||||
reverse_switch_windows = "<S-Tab>",
|
||||
remove_file = "d",
|
||||
add_file = "@",
|
||||
close = { "<Esc>", "q" },
|
||||
close_from_input = nil, -- e.g., { normal = "<Esc>", insert = "<C-d>" }
|
||||
},
|
||||
},
|
||||
hints = { enabled = true },
|
||||
|
||||
@@ -392,10 +392,7 @@ M._defaults = {
|
||||
remove_file = "d",
|
||||
add_file = "@",
|
||||
close = { "<Esc>", "q" },
|
||||
close_from_input = {
|
||||
normal = "<Esc>",
|
||||
insert = "<C-d>",
|
||||
},
|
||||
close_from_input = nil, -- e.g., { normal = "<Esc>", insert = "<C-d>" }
|
||||
},
|
||||
files = {
|
||||
add_current = "<leader>ac", -- Add current buffer to selected files
|
||||
|
||||
@@ -2719,8 +2719,12 @@ function Sidebar:create_input_container(opts)
|
||||
|
||||
self.input_container:map("n", Config.mappings.submit.normal, on_submit)
|
||||
self.input_container:map("i", Config.mappings.submit.insert, on_submit)
|
||||
self.input_container:map("n", Config.mappings.sidebar.close_from_input.normal, function() self:shutdown() end)
|
||||
self.input_container:map("i", Config.mappings.sidebar.close_from_input.insert, function() self:shutdown() end)
|
||||
|
||||
local close_from_input = Config.mappings.sidebar.close_from_input
|
||||
if close_from_input ~= nil then
|
||||
self.input_container:map("n", close_from_input.normal, function() self:shutdown() end)
|
||||
self.input_container:map("i", close_from_input.insert, function() self:shutdown() end)
|
||||
end
|
||||
|
||||
api.nvim_set_option_value("filetype", "AvanteInput", { buf = self.input_container.bufnr })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user