GithubHelp home page GithubHelp logo

sasha1ururu / avante.nvim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yetone/avante.nvim

0.0 0.0 0.0 98 KB

Use your Neovim like using Cursor AI IDE!

License: Apache License 2.0

Lua 97.84% Makefile 2.16%

avante.nvim's Introduction

avante.nvim (Alpha)

avante.nvim is a Neovim plugin designed to emulate the behavior of the Cursor 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.

avante-2.mp4
avante-3.mp4

Features

  • AI-Powered Code Assistance: Interact with AI to ask questions about your current code file and receive intelligent suggestions for improvement or modification.
  • One-Click Application: Quickly apply the AI's suggested changes to your source code with a single command, streamlining the editing process and saving time.

Installation

Install avante.nvim using lazy.nvim:

{
  "yetone/avante.nvim",
  event = "VeryLazy",
  opts = {},
  build = "make",
  dependencies = {
    "nvim-tree/nvim-web-devicons",
    {
      "grapp-dev/nui-components.nvim",
      dependencies = {
        "MunifTanjim/nui.nvim"
      }
    },
    "nvim-lua/plenary.nvim",
    "MeanderingProgrammer/render-markdown.nvim",
  },
}

Important

If your neovim doesn't use LuaJIT, then change build to make lua51. By default running make will install luajit. For ARM-based setup, make sure to also install cargo as we will have to build the tiktoken_core from source.

Default setup configuration:

{
  provider = "claude", -- "claude" or "openai" or "azure"
  openai = {
    endpoint = "https://api.openai.com",
    model = "gpt-4o",
    temperature = 0,
    max_tokens = 4096,
  },
  azure = {
    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,
    max_tokens = 4096,
  },
  claude = {
    endpoint = "https://api.anthropic.com",
    model = "claude-3-5-sonnet-20240620",
    temperature = 0,
    max_tokens = 4096,
  },
  highlights = {
    diff = {
      current = "DiffText", -- need have background color
      incoming = "DiffAdd", -- 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:

  1. Set the appropriate API key as an environment variable:

    For Claude:

    export ANTHROPIC_API_KEY=your-api-key

    For OpenAI:

    export OPENAI_API_KEY=your-api-key

    For Azure OpenAI:

    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.

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.

Key Bindings

The following key bindings are available for use with avante.nvim:

  • Leaderaa — show sidebar
  • co — choose ours
  • ct — choose theirs
  • cb — choose both
  • c0 — choose none
  • ]x — move to previous conflict
  • [x — move to next conflict

Roadmap

  • Enhanced AI Interactions: Improve the depth of AI analysis and recommendations for more complex coding scenarios.
  • Stability Improvements: Refactor and optimize the codebase to enhance the stability and reliability of the plugin.
  • Expanded Features: Introduce additional customization options and new features to support a wider range of coding tasks.

TODOs

  • Chat with current file
  • Apply diff patch
  • Chat with selected block
  • Chat with project
  • Chat with selected files
  • Auto suggestion and completion

Contributing

Contributions to avante.nvim are welcome! If you're interested in helping out, please feel free to submit pull requests or open issues. Before contributing, ensure that your code has been thoroughly tested.

Development

To set up the development environment:

  1. Install StyLua for Lua code formatting.
  2. Install pre-commit for managing and maintaining pre-commit hooks.
  3. After cloning the repository, run the following command to set up pre-commit hooks:
pre-commit install --install-hooks

License

avante.nvim is licensed under the Apache License. For more details, please refer to the LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.