feat: add mappings to toggle code window from input in sidebar (#2591)
This commit is contained in:
@@ -548,6 +548,9 @@ M._defaults = {
|
|||||||
---@alias AvanteCloseFromInput { normal: string | nil, insert: string | nil }
|
---@alias AvanteCloseFromInput { normal: string | nil, insert: string | nil }
|
||||||
---@type AvanteCloseFromInput | nil
|
---@type AvanteCloseFromInput | nil
|
||||||
close_from_input = nil, -- e.g., { normal = "<Esc>", insert = "<C-d>" }
|
close_from_input = nil, -- e.g., { normal = "<Esc>", insert = "<C-d>" }
|
||||||
|
---@alias AvanteToggleCodeWindowFromInput { normal: string | nil, insert: string | nil }
|
||||||
|
---@type AvanteToggleCodeWindowFromInput | nil
|
||||||
|
toggle_code_window_from_input = nil, -- e.g., { normal = "x", insert = "<C-;>" }
|
||||||
},
|
},
|
||||||
files = {
|
files = {
|
||||||
add_current = "<leader>ac", -- Add current buffer to selected files
|
add_current = "<leader>ac", -- Add current buffer to selected files
|
||||||
|
|||||||
@@ -2729,6 +2729,23 @@ function Sidebar:create_input_container()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Config.mappings.sidebar.toggle_code_window_from_input ~= nil then
|
||||||
|
if Config.mappings.sidebar.toggle_code_window_from_input.normal ~= nil then
|
||||||
|
self.containers.input:map(
|
||||||
|
"n",
|
||||||
|
Config.mappings.sidebar.toggle_code_window_from_input.normal,
|
||||||
|
function() self:toggleCodeWindow() end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if Config.mappings.sidebar.toggle_code_window_from_input.insert ~= nil then
|
||||||
|
self.containers.input:map(
|
||||||
|
"i",
|
||||||
|
Config.mappings.sidebar.toggle_code_window_from_input.insert,
|
||||||
|
function() self:toggleCodeWindow() end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
api.nvim_set_option_value("filetype", "AvanteInput", { buf = self.containers.input.bufnr })
|
api.nvim_set_option_value("filetype", "AvanteInput", { buf = self.containers.input.bufnr })
|
||||||
|
|
||||||
-- Setup completion
|
-- Setup completion
|
||||||
|
|||||||
Reference in New Issue
Block a user