feat(ui): add envvar popup with warnings (#54)

* feat: add support for input popup of envvar

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

* chore: update README and ignore certain filetypes for popup

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

* fix: readme doesn't support nested callout

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

---------

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-08-17 16:04:40 -04:00
committed by GitHub
parent f4ab995515
commit af1f51455e
6 changed files with 228 additions and 42 deletions

View File

@@ -3,9 +3,9 @@
**avante.nvim** is a Neovim plugin designed to emulate the behavior of the [Cursor](https://www.cursor.com) AI IDE, providing users with AI-driven code suggestions and the ability to apply these recommendations directly to their source files with minimal effort.
> [!NOTE]
>
>
> ⚠️ This plugin is still in a very early stage of development, so please be aware that the current code is very messy and unstable, and problems are likely to occur.
>
>
> 🥰 This project is undergoing rapid iterations, and many exciting features will be added successively. Stay tuned!
https://github.com/user-attachments/assets/510e6270-b6cf-459d-9a2f-15b397d1fe53
@@ -69,8 +69,11 @@ Install `avante.nvim` using [lazy.nvim](https://github.com/folke/lazy.nvim):
Default setup configuration:
_See [config.lua#L9](./lua/avante/config.lua) for the full config_
```lua
{
---@alias Provider "openai" | "claude" | "azure"
provider = "claude", -- "claude" or "openai" or "azure"
openai = {
endpoint = "https://api.openai.com",
@@ -79,7 +82,7 @@ Default setup configuration:
max_tokens = 4096,
},
azure = {
endpoint = "", -- Example: "https://<your-resource-name>.openai.azure.com"
endpoint = "", -- example: "https://<your-resource-name>.openai.azure.com"
deployment = "", -- Azure deployment name (e.g., "gpt-4o", "my-gpt-4o-deployment")
api_version = "2024-06-01",
temperature = 0,
@@ -92,13 +95,17 @@ Default setup configuration:
max_tokens = 4096,
},
highlights = {
---@type AvanteConflictHighlights
diff = {
current = "DiffText", -- need have background color
incoming = "DiffAdd", -- need have background color
current = "DiffText",
incoming = "DiffAdd",
},
},
mappings = {
ask = "<leader>aa",
edit = "<leader>ae",
refresh = "<leader>ar",
--- @class AvanteConflictMappings
diff = {
ours = "co",
theirs = "ct",
@@ -107,6 +114,20 @@ Default setup configuration:
next = "]x",
prev = "[x",
},
jump = {
next = "]]",
prev = "[[",
},
},
windows = {
width = 30, -- default % based on available width
},
--- @class AvanteConflictUserConfig
diff = {
debug = false,
autojump = true,
---@type string | fun(): any
list_opener = "copen",
},
}
```
@@ -115,30 +136,33 @@ Default setup configuration:
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
1. Set the appropriate API key as an environment variable:
> [!IMPORTANT]
>
> For most consistency between neovim session, it is recommended to set the environment variables in your shell file.
> By default, `Avante` will prompt you at startup to input the API key for the provider you have selected.
>
> For Claude:
>
> ```sh
> export ANTHROPIC_API_KEY=your-api-key
> ```
>
> For OpenAI:
>
> ```sh
> export OPENAI_API_KEY=your-api-key
> ```
>
> For Azure OpenAI:
>
> ```sh
> export AZURE_OPENAI_API_KEY=your-api-key
> ```
For Claude:
```sh
export ANTHROPIC_API_KEY=your-api-key
```
For OpenAI:
```sh
export OPENAI_API_KEY=your-api-key
```
For Azure OpenAI:
```sh
export AZURE_OPENAI_API_KEY=your-api-key
```
2. Open a code file in Neovim.
3. Use the `:AvanteAsk` command to query the AI about the code.
4. Review the AI's suggestions.
5. Apply the recommended changes directly to your code with a simple command or key binding.
1. Open a code file in Neovim.
2. Use the `:AvanteAsk` command to query the AI about the code.
3. Review the AI's suggestions.
4. Apply the recommended changes directly to your code with a simple command or key binding.
**Note**: The plugin is still under active development, and both its functionality and interface are subject to significant changes. Expect some rough edges and instability as the project evolves.
@@ -147,6 +171,7 @@ Given its early stage, `avante.nvim` currently supports the following basic func
The following key bindings are available for use with `avante.nvim`:
- <kbd>Leader</kbd><kbd>a</kbd><kbd>a</kbd> — show sidebar
- <kbd>Leader</kbd><kbd>a</kbd><kbd>r</kbd> — show sidebar
- <kbd>c</kbd><kbd>o</kbd> — choose ours
- <kbd>c</kbd><kbd>t</kbd> — choose theirs
- <kbd>c</kbd><kbd>b</kbd> — choose both