diff --git a/README.md b/README.md index 3741022..e6cc3b7 100644 --- a/README.md +++ b/README.md @@ -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 = "", reverse_switch_windows = "", + remove_file = "d", + add_file = "@", + close = { "", "q" }, + close_from_input = nil, -- e.g., { normal = "", insert = "" } }, }, hints = { enabled = true }, diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 4edb9ab..56867e0 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -392,10 +392,7 @@ M._defaults = { remove_file = "d", add_file = "@", close = { "", "q" }, - close_from_input = { - normal = "", - insert = "", - }, + close_from_input = nil, -- e.g., { normal = "", insert = "" } }, files = { add_current = "ac", -- Add current buffer to selected files diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index d82390a..b1b72b3 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -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 })