fix: binding shortcuts to specific buffers (#238)

This commit is contained in:
yetone
2024-08-26 18:26:56 +08:00
committed by GitHub
parent 8cd87ac5de
commit c75dc48356
5 changed files with 172 additions and 14 deletions

View File

@@ -1279,11 +1279,11 @@ function Sidebar:create_input()
handle_submit(request)
end
self.input:mount()
self.input:map("n", Config.mappings.submit.normal, on_submit)
self.input:map("i", Config.mappings.submit.insert, on_submit)
self.input:mount()
api.nvim_set_option_value("filetype", "AvanteInput", { buf = self.input.bufnr })
-- Setup completion
@@ -1463,6 +1463,8 @@ function Sidebar:render()
},
})
self.result:mount()
self.result:on(event.BufWinEnter, function()
xpcall(function()
api.nvim_buf_set_name(self.result.bufnr, RESULT_BUF_NAME)
@@ -1479,8 +1481,6 @@ function Sidebar:render()
self:close()
end)
self.result:mount()
self.input_container = Split({
enter = false,
relative = {