diff --git a/README.md b/README.md index fe1f00a..865c361 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,10 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_ normal = "", insert = "", }, + sidebar = { + switch_windows = "", + reverse_switch_windows = "", + }, }, hints = { enabled = true }, windows = { diff --git a/lua/avante/config.lua b/lua/avante/config.lua index c1689d7..ab132cd 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -148,6 +148,10 @@ You are an excellent programming expert. hint = "ah", suggestion = "as", }, + sidebar = { + switch_windows = "", + reverse_switch_windows = "", + }, }, windows = { ---@alias AvantePosition "right" | "left" | "top" | "bottom" diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index da09739..c938c06 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -616,8 +616,12 @@ function Sidebar:render_input(ask) local code_file_fullpath = api.nvim_buf_get_name(self.code.bufnr) local code_filename = fn.fnamemodify(code_file_fullpath, ":t") - local header_text = - string.format("󱜸 %s %s %s (: switch focus)", ask and "Ask" or "Chat with", icon, code_filename) + local header_text = string.format( + "󱜸 %s %s %s (" .. Config.mappings.sidebar.switch_windows .. ": switch focus)", + ask and "Ask" or "Chat with", + icon, + code_filename + ) if self.code.selection ~= nil then header_text = string.format( @@ -887,15 +891,15 @@ function Sidebar:refresh_winids() for _, winid in ipairs(winids) do local buf = api.nvim_win_get_buf(winid) - vim.keymap.set( + Utils.safe_keymap_set( { "n", "i" }, - "", + Config.mappings.sidebar.switch_windows, function() switch_windows() end, { buffer = buf, noremap = true, silent = true } ) - vim.keymap.set( + Utils.safe_keymap_set( { "n", "i" }, - "", + Config.mappings.sidebar.reverse_switch_windows, function() reverse_switch_windows() end, { buffer = buf, noremap = true, silent = true } )