feat: add windows.ask.focus_on_apply config option ()

This commit is contained in:
Maddison Hellstrom 2024-11-02 03:33:08 -07:00 committed by GitHub
parent 1aa8b03f00
commit 8e8f2c15ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

@ -270,6 +270,8 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
start_insert = true, -- Start insert mode when opening the ask window, only effective if floating = true.
border = "rounded",
---@type "ours" | "theirs"
focus_on_apply = "ours", -- which diff to focus after applying
},
},
highlights = {

@ -181,6 +181,8 @@ Respect and use existing conventions, libraries, etc that are already present in
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
border = "rounded",
start_insert = true, -- Start insert mode when opening the ask window
---@alias AvanteInitialDiff "ours" | "theirs"
focus_on_apply = "ours", -- which diff to focus after applying
},
},
--- @class AvanteConflictConfig

@ -569,7 +569,7 @@ function Sidebar:apply(current_cursor)
Diff.process(bufnr)
api.nvim_win_set_cursor(winid, { 1, 0 })
vim.defer_fn(function()
Diff.find_next("ours")
Diff.find_next(Config.windows.ask.focus_on_apply)
vim.cmd("normal! zz")
end, 100)
::continue::