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
|
## Usage
|
||||||
|
|
||||||
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
|
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
|
||||||
|
@ -602,7 +602,7 @@ function M.render_sidebar()
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.config = {
|
M.config = {
|
||||||
provider = "claude",
|
provider = "claude", -- "claude" or "openai"
|
||||||
openai = {
|
openai = {
|
||||||
model = "gpt-4o",
|
model = "gpt-4o",
|
||||||
temperature = 0,
|
temperature = 0,
|
||||||
@ -613,32 +613,41 @@ M.config = {
|
|||||||
temperature = 0,
|
temperature = 0,
|
||||||
max_tokens = 4096,
|
max_tokens = 4096,
|
||||||
},
|
},
|
||||||
|
highlights = {
|
||||||
|
diff = {
|
||||||
|
incoming = "DiffAdded", -- need have background color
|
||||||
|
current = "DiffRemoved", -- need have background color
|
||||||
|
},
|
||||||
|
},
|
||||||
mappings = {
|
mappings = {
|
||||||
show_sidebar = "<leader>aa",
|
show_sidebar = "<leader>aa",
|
||||||
apply = "co",
|
diff = {
|
||||||
reject = "ct",
|
ours = "co",
|
||||||
|
theirs = "ct",
|
||||||
|
none = "c0",
|
||||||
|
both = "cb",
|
||||||
next = "]x",
|
next = "]x",
|
||||||
prev = "[x",
|
prev = "[x",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
|
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
||||||
|
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
if is_code_buf(bufnr) then
|
if is_code_buf(bufnr) then
|
||||||
_cur_code_buf = bufnr
|
_cur_code_buf = bufnr
|
||||||
end
|
end
|
||||||
|
|
||||||
diff.setup({
|
diff.setup({
|
||||||
debug = false, -- log output to console
|
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
|
default_commands = true, -- disable commands created by this plugin
|
||||||
disable_diagnostics = true, -- This will disable the diagnostics in a buffer whilst it is conflicted
|
disable_diagnostics = true, -- This will disable the diagnostics in a buffer whilst it is conflicted
|
||||||
list_opener = "copen",
|
list_opener = "copen",
|
||||||
highlights = {
|
highlights = M.config.highlights.diff,
|
||||||
incoming = "DiffAdded",
|
|
||||||
current = "DiffRemoved",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
|
|
||||||
|
|
||||||
local function on_buf_enter()
|
local function on_buf_enter()
|
||||||
bufnr = vim.api.nvim_get_current_buf()
|
bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user