diff --git a/README.md b/README.md index a760303f..a5fd09cf 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ Also see [here](/lua/CopilotChat/config.lua): -- default window options window = { - layout = 'vertical', -- 'vertical', 'horizontal', 'float' + layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace' width = 0.5, -- fractional width of parent, or absolute width in columns when > 1 height = 0.5, -- fractional height of parent, or absolute height in rows when > 1 -- Options below only apply to floating windows diff --git a/lua/CopilotChat/chat.lua b/lua/CopilotChat/chat.lua index 3b8a3540..243303a2 100644 --- a/lua/CopilotChat/chat.lua +++ b/lua/CopilotChat/chat.lua @@ -153,6 +153,9 @@ function Chat:open(config) self.winnr = vim.api.nvim_get_current_win() vim.api.nvim_win_set_buf(self.winnr, self.bufnr) vim.api.nvim_set_current_win(orig) + elseif layout == 'replace' then + self.winnr = vim.api.nvim_get_current_win() + vim.api.nvim_win_set_buf(self.winnr, self.bufnr) end vim.wo[self.winnr].wrap = true diff --git a/lua/CopilotChat/config.lua b/lua/CopilotChat/config.lua index 3cd586a1..3fa28d00 100644 --- a/lua/CopilotChat/config.lua +++ b/lua/CopilotChat/config.lua @@ -179,7 +179,7 @@ return { -- default window options window = { - layout = 'vertical', -- 'vertical', 'horizontal', 'float' + layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace' width = 0.5, -- fractional width of parent, or absolute width in columns when > 1 height = 0.5, -- fractional height of parent, or absolute height in rows when > 1 -- Options below only apply to floating windows