feat: add windows.ask.focus_on_apply config option (#779)
This commit is contained in:
		
							parent
							
								
									1aa8b03f00
								
							
						
					
					
						commit
						8e8f2c15ab
					
				@ -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
 | 
					      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.
 | 
					      start_insert = true, -- Start insert mode when opening the ask window, only effective if floating = true.
 | 
				
			||||||
      border = "rounded",
 | 
					      border = "rounded",
 | 
				
			||||||
 | 
					      ---@type "ours" | "theirs"
 | 
				
			||||||
 | 
					      focus_on_apply = "ours", -- which diff to focus after applying
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  highlights = {
 | 
					  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
 | 
					      floating = false, -- Open the 'AvanteAsk' prompt in a floating window
 | 
				
			||||||
      border = "rounded",
 | 
					      border = "rounded",
 | 
				
			||||||
      start_insert = true, -- Start insert mode when opening the ask window
 | 
					      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
 | 
					  --- @class AvanteConflictConfig
 | 
				
			||||||
 | 
				
			|||||||
@ -569,7 +569,7 @@ function Sidebar:apply(current_cursor)
 | 
				
			|||||||
      Diff.process(bufnr)
 | 
					      Diff.process(bufnr)
 | 
				
			||||||
      api.nvim_win_set_cursor(winid, { 1, 0 })
 | 
					      api.nvim_win_set_cursor(winid, { 1, 0 })
 | 
				
			||||||
      vim.defer_fn(function()
 | 
					      vim.defer_fn(function()
 | 
				
			||||||
        Diff.find_next("ours")
 | 
					        Diff.find_next(Config.windows.ask.focus_on_apply)
 | 
				
			||||||
        vim.cmd("normal! zz")
 | 
					        vim.cmd("normal! zz")
 | 
				
			||||||
      end, 100)
 | 
					      end, 100)
 | 
				
			||||||
      ::continue::
 | 
					      ::continue::
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user