Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

CHACE.nvim is an AI based code completion plugin built for neovim targetting power users or people who are fed up with AI splashing slop all over their codebases. It utilizes a blazing fast treesitter based backend CHACE that parses the current buffer, selects and sends the minimal context (which can only be expanded on user's decision) to an LLM of choice for generating implementaions.

This is not an inline completion tool for completing every line you type. I specifically built this for trying out a new zen AI code completions experience where a user only calls an LLM when needed for implementing complex (or cumbersome) logics which lives inside functions/methods most of the time. I believe this approach is better because this way we can lay the blueprints (the classes, objects, structs and traits) ourselves and only call an LLM for help to implement something that is complicated or lazy to implement manually.

Note

This plugin is in early-development so bugs and breaking changes might occur.

Demo

CHACE demo showing it's cabapilities

Features

  • Targets function declerations at cursor position
  • Sends minimal context to LLM ( as of now function decleration, documentation and user selected context only)
  • Supports multiple LLM backends (Gemini, groq)
  • Incurs less tokens compared to tools like GitHub Copilot or agents like cursor for implementing the same function.
  • Tracks token usage.

Requirements

  • Neovim 0.11+
  • CHACE engine installed (see CHACE)
  • Unix socket support (Linux/macOS)

Installation

Using lazy.nvim:

{
  'chamal1120/chace.nvim',
  cmd = { "Chace", "ChaceAddSnippet", "ChaceClearContexts" },
  keys = { 
      { "<leader>c", desc = "Chace Run" },
      { "<leader>ct", mode = "v", desc = "Chace Add Snippet" } 
  },
  config = function()
    require('chace').setup({
      debug = false,
      show_notifications = true,
    })
  end
}

Using packer.nvim:

use {
  'chamal1120/chace.nvim',
  cmd = { "Chace", "ChaceAddSnippet", "ChaceClearContexts" },
  keys = { 
      { "<leader>c", desc = "Chace Run" },
      { "<leader>ct", mode = "v", desc = "Chace Add Snippet" } 
  },
  config = function()
    require('chace').setup({
      debug = false,
      show_notifications = true,
    })
  end
}

Setup

  1. Configure environment variables for LLM providers:
export GEMINI_API_KEY="your-api-key"
export GROQ_API_KEY="your-api-key"

Usage

  1. Place your cursor inside an empty function decleration and trigger completion:
:Chace

or use the keybind leader + c

Configuration

Default configuration:

require('chace').setup({
  debug =               false,          -- Set to true to enable debug logs
  show_notifications =  true,           -- Set to false to suppress all notifications
  model =               "groq",         -- set model (Gemini/groq)
  keymap =              "<leader>c",    -- set completion key
  add_keymap =          "<leader>ct",   -- set add to context key
  clear_keymap =        "<leader>cu",   -- set clear contexts list key
})

License

MIT License - see LICENSE for details.

About

A token efficient and less intrusive AI code completion plugin for neovim

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages