docs: Avante Chat History Selector Documentation and Commands (#1862)
This commit is contained in:
@@ -622,6 +622,7 @@ The following key bindings are available for use with `avante.nvim`:
|
|||||||
| <kbd>Leader</kbd><kbd>a</kbd><kbd>?</kbd> | select model |
|
| <kbd>Leader</kbd><kbd>a</kbd><kbd>?</kbd> | select model |
|
||||||
| <kbd>Leader</kbd><kbd>a</kbd><kbd>e</kbd> | edit selected blocks |
|
| <kbd>Leader</kbd><kbd>a</kbd><kbd>e</kbd> | edit selected blocks |
|
||||||
| <kbd>Leader</kbd><kbd>a</kbd><kbd>S</kbd> | stop current AI request |
|
| <kbd>Leader</kbd><kbd>a</kbd><kbd>S</kbd> | stop current AI request |
|
||||||
|
| <kbd>Leader</kbd><kbd>a</kbd><kbd>h</kbd> | select between chat histories |
|
||||||
| <kbd>c</kbd><kbd>o</kbd> | choose ours |
|
| <kbd>c</kbd><kbd>o</kbd> | choose ours |
|
||||||
| <kbd>c</kbd><kbd>t</kbd> | choose theirs |
|
| <kbd>c</kbd><kbd>t</kbd> | choose theirs |
|
||||||
| <kbd>c</kbd><kbd>a</kbd> | choose all theirs |
|
| <kbd>c</kbd><kbd>a</kbd> | choose all theirs |
|
||||||
@@ -696,7 +697,9 @@ return {
|
|||||||
| `:AvanteAsk [question] [position]` | Ask AI about your code. Optional `position` set window position and `ask` enable/disable direct asking mode | `:AvanteAsk position=right Refactor this code here` |
|
| `:AvanteAsk [question] [position]` | Ask AI about your code. Optional `position` set window position and `ask` enable/disable direct asking mode | `:AvanteAsk position=right Refactor this code here` |
|
||||||
| `:AvanteBuild` | Build dependencies for the project | |
|
| `:AvanteBuild` | Build dependencies for the project | |
|
||||||
| `:AvanteChat` | Start a chat session with AI about your codebase. Default is `ask`=false | |
|
| `:AvanteChat` | Start a chat session with AI about your codebase. Default is `ask`=false | |
|
||||||
| `:AvanteClear` | Clear the chat history | |
|
| `:AvanteChatNew` | Start a new chat session. The current chat can be re-opened with the chat session selector | |
|
||||||
|
| `:AvanteHistory` | Opens a picker for your previous chat sessions | |
|
||||||
|
| `:AvanteClear` | Clear the chat history for your current chat session | |
|
||||||
| `:AvanteEdit` | Edit the selected code blocks | |
|
| `:AvanteEdit` | Edit the selected code blocks | |
|
||||||
| `:AvanteFocus` | Switch focus to/from the sidebar | |
|
| `:AvanteFocus` | Switch focus to/from the sidebar | |
|
||||||
| `:AvanteRefresh` | Refresh all Avante windows | |
|
| `:AvanteRefresh` | Refresh all Avante windows | |
|
||||||
|
|||||||
@@ -52,8 +52,20 @@ function M.open(bufnr, cb)
|
|||||||
local history = Path.history.load(vim.api.nvim_get_current_buf(), item.filename)
|
local history = Path.history.load(vim.api.nvim_get_current_buf(), item.filename)
|
||||||
local Sidebar = require("avante.sidebar")
|
local Sidebar = require("avante.sidebar")
|
||||||
local content = Sidebar.render_history_content(history)
|
local content = Sidebar.render_history_content(history)
|
||||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, vim.split(content or "", "\n"))
|
local lines = vim.split(content or "", "\n")
|
||||||
|
-- Ensure the buffer exists and is valid before setting lines
|
||||||
|
if vim.api.nvim_buf_is_valid(self.state.bufnr) then
|
||||||
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
|
-- Set filetype after content is loaded
|
||||||
vim.api.nvim_set_option_value("filetype", "markdown", { buf = self.state.bufnr })
|
vim.api.nvim_set_option_value("filetype", "markdown", { buf = self.state.bufnr })
|
||||||
|
-- Ensure cursor is within bounds
|
||||||
|
vim.schedule(function()
|
||||||
|
if vim.api.nvim_buf_is_valid(self.state.bufnr) then
|
||||||
|
local row = math.min(vim.api.nvim_buf_line_count(self.state.bufnr), 1)
|
||||||
|
pcall(vim.api.nvim_win_set_cursor, self.state.winnr, { row, 0 })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
attach_mappings = function(prompt_bufnr, map)
|
attach_mappings = function(prompt_bufnr, map)
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ end, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
cmd("Chat", function() require("avante.api").ask({ ask = false }) end, { desc = "avante: chat with the codebase" })
|
cmd("Chat", function() require("avante.api").ask({ ask = false }) end, { desc = "avante: chat with the codebase" })
|
||||||
|
cmd(
|
||||||
|
"ChatNew",
|
||||||
|
function() require("avante.api").ask({ ask = false, new_chat = true }) end,
|
||||||
|
{ desc = "avante: create new chat" }
|
||||||
|
)
|
||||||
cmd("Toggle", function() require("avante").toggle() end, { desc = "avante: toggle AI panel" })
|
cmd("Toggle", function() require("avante").toggle() end, { desc = "avante: toggle AI panel" })
|
||||||
cmd("Build", function(opts)
|
cmd("Build", function(opts)
|
||||||
local args = {}
|
local args = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user