Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neovim Rust Qwen2.5-Coder

chilljinn.nvim

chilljinn.nvim is a local-first AI autocomplete for Neovim, built on Rust. It extends coward.nvim: a Qwen2.5-Coder GGUF runs through llama-cpp-2 and fills a Trie that the nvim-cmp source reads. Everything is offline — no cloud, no telemetry.

It is context-aware: at each line it injects the real signatures of your project, its dependencies, and the language stdlib, and constrains generation with a GBNF grammar so the model can't hallucinate a symbol that doesn't exist.

Dependencies

  • Rust
  • SQLite (via rusqlite)
  • nvim-cmp
  • A GPU backend feature: vulkan (any GPU) or cuda — optional, falls back to CPU.
  • Python (setup only) to fetch the model.

Implementation

The Rust core (libchilljinn, a cdylib loaded inside Neovim) holds an in-RAM Trie for instant completions and a name -> signature index of the session pwd (plus dependency source), built with tree-sitter. A background thread runs the model and fills the Trie, so Neovim never blocks. Everything persistent lives in one SQLite file. This keeps the plugin fast and bloat-free.

Installation

Install the plugin where Neovim can find it (a native package dir works):

git clone https://github.com/AshLink95/chilljinn.nvim.git \
  ~/.config/nvim/pack/plugins/start/chilljinn.nvim
cd ~/.config/nvim/pack/plugins/start/chilljinn.nvim

pip install huggingface_hub platformdirs
python install.py                          # fetch GGUF -> ~/.local/share/chilljinn/models
cargo build --release --features vulkan    # or --features cuda (CPU if omitted)

Or with a plugin manager (build the .so after install), e.g. lazy.nvim:

{
  'AshLink95/chilljinn.nvim',
  build = 'cargo build --release --features vulkan',
  dependencies = { 'hrsh7th/nvim-cmp' },
  config = function() require('chilljinn').setup({}) end,
}

Run python install.py once to fetch the model regardless of install method.

Everything persistent lives in ~/.local/share/chilljinn: the model (models/, with a current_model pointer the Rust side reads at startup) and the SQLite DB (chilljinn.db). Pick a model size/quant with python install.py --size 1.5b --quant q4_k_m.

Setup and Configuration

Add the source to nvim-cmp and (optionally) tune options:

require('chilljinn').setup({
  enabled = true,   -- constant AI autocomplete
  grammar = true,   -- GBNF anti-hallucination (disable if a grammar ever aborts)
  max_items = 10,   -- max suggestions shown
  max_len = 120,    -- drop suggestions longer than this many chars
  window = 50,      -- lines of context each side of the cursor
})

local cmp = require('cmp')
cmp.setup({ sources = cmp.config.sources({ { name = 'chilljinn' } }) })

Defaults: enabled = true, grammar = true, max_items = 10, max_len = 120, window = 50.

Suggestions show under a neon-green AI kind automatically — the plugin sets it per-item (item.cmp.kind_text) and owns the CmpItemKindAI highlight, so no cmp formatting config is required.

Usage

Nothing loads until you ask. Launch Neovim from your project root and run:

  • :CJ start — loads the model and indexes the project (prints ChillJinn inbound).
  • :CJ stop — frees the model and depopulates every trie (prints ChillJinn back in the bottle).

Once started, open a file (Rust or Python get full context; other languages get plain model completion) and type — suggestions appear as you go, marked green AI. The model runs in the background, so the first suggestions on a fresh start take a moment to warm.

Learning your style

ChillJinn can pick up your coding style and fold it into every suggestion:

  • :CJ sample — stash real-code snippets from the current file (strings and filler are skipped; nothing empty is stored).
  • :CJ imply — the model reviews the stashed snippets and distills a few style rules (naming, spacing, error handling, idioms), then clears the samples. The rules are injected into the completion prompt from then on.

Sample a few files you like, run imply, and the model nudges its completions toward your conventions. Both commands run in the background and never block the editor.

cj-shell — error-aware completions

cj-shell is a contained capturing shell (vi/emacs bindings, tab completion). Run your builds and programs inside it; it parses compiler and debugger output (cargo, GNU, MSVC, Python tracebacks, gdb/rust-gdb) into the DB, and ChillJinn uses those errors to suggest fixes on the offending line.

./target/release/cj-shell        # then: cargo build, python app.py, gdb ./a.out, ...

Errors are wiped when the project next compiles clean, and stale ones pruned after an hour.

How this was built

chilljinn.nvim was pretty much vibe coded with big laude

About

A local AI autocomplete engine for Neovim

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages