Skip to content

Commit

Permalink
feat: add windows.ask.focus_on_apply config option (yetone#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
b0o authored Nov 2, 2024
1 parent 1aa8b03 commit 8e8f2c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 2 additions & 0 deletions lua/avante/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lua/avante/sidebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down

0 comments on commit 8e8f2c1

Please sign in to comment.