feat: use custom configs
This commit is contained in:
parent
18df41434e
commit
29a1a9a359
35
README.md
35
README.md
@ -40,6 +40,41 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim):
|
||||
}
|
||||
```
|
||||
|
||||
Default setup configuration:
|
||||
|
||||
```lua
|
||||
{
|
||||
provider = "claude", -- openai, claude
|
||||
openai = {
|
||||
model = "gpt-4o",
|
||||
temperature = 0,
|
||||
max_tokens = 4096,
|
||||
},
|
||||
claude = {
|
||||
model = "claude-3-5-sonnet-20240620",
|
||||
temperature = 0,
|
||||
max_tokens = 4096,
|
||||
},
|
||||
highlights = {
|
||||
diff = {
|
||||
incoming = "DiffAdded", -- need have background color
|
||||
current = "DiffRemoved", -- need have background color
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
show_sidebar = "<leader>aa",
|
||||
diff = {
|
||||
ours = "co",
|
||||
theirs = "ct",
|
||||
none = "c0",
|
||||
both = "cb",
|
||||
next = "]x",
|
||||
prev = "[x",
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
|
||||
|
@ -602,7 +602,7 @@ function M.render_sidebar()
|
||||
end
|
||||
|
||||
M.config = {
|
||||
provider = "claude",
|
||||
provider = "claude", -- "claude" or "openai"
|
||||
openai = {
|
||||
model = "gpt-4o",
|
||||
temperature = 0,
|
||||
@ -613,32 +613,41 @@ M.config = {
|
||||
temperature = 0,
|
||||
max_tokens = 4096,
|
||||
},
|
||||
highlights = {
|
||||
diff = {
|
||||
incoming = "DiffAdded", -- need have background color
|
||||
current = "DiffRemoved", -- need have background color
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
show_sidebar = "<leader>aa",
|
||||
apply = "co",
|
||||
reject = "ct",
|
||||
next = "]x",
|
||||
prev = "[x",
|
||||
diff = {
|
||||
ours = "co",
|
||||
theirs = "ct",
|
||||
none = "c0",
|
||||
both = "cb",
|
||||
next = "]x",
|
||||
prev = "[x",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function M.setup(opts)
|
||||
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
if is_code_buf(bufnr) then
|
||||
_cur_code_buf = bufnr
|
||||
end
|
||||
|
||||
diff.setup({
|
||||
debug = false, -- log output to console
|
||||
default_mappings = true, -- disable buffer local mapping created by this plugin
|
||||
default_mappings = M.config.mappings.diff, -- disable buffer local mapping created by this plugin
|
||||
default_commands = true, -- disable commands created by this plugin
|
||||
disable_diagnostics = true, -- This will disable the diagnostics in a buffer whilst it is conflicted
|
||||
list_opener = "copen",
|
||||
highlights = {
|
||||
incoming = "DiffAdded",
|
||||
current = "DiffRemoved",
|
||||
},
|
||||
highlights = M.config.highlights.diff,
|
||||
})
|
||||
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
||||
|
||||
local function on_buf_enter()
|
||||
bufnr = vim.api.nvim_get_current_buf()
|
||||
|
Loading…
x
Reference in New Issue
Block a user