Skip to content

PyDevC/model-cmp.nvim

Repository files navigation

Model-cmp.nvim

AI autocomplete with Treesitter Context Engine, and Local LLM and GEMINI Support.

Model-cmp uses various features of neovim to Deliver AI autocompletion features by predicting the current line text. We use Treesitter deeply to generate Context around the cursor (Treesitter implementation of Context Engine is under development). We use Few shot prompting to get custom suggestions from the LLM.

You can use which ever LLM you want till its on port you specified in your config. 2025-11-02-081401_hyprshot 2025-11-02-081433_hyprshot

model-cmp.mp4

Installation

Before installing the plugin, please make sure you have following pre-requisities:

Lazy.nvim

{
    "PyDevC/model-cmp.nvim",
    config = function()
        require("model_cmp").setup()
        vim.keymap.set("i", "<C-s>", "<cmd>ModelCmp capture first<CR>")
    end
}

Setup Gemini API key

There are two ways to setup gemini api keys:

  1. Environment variable
  2. Inside config
  • Environment variable:
export GEMINI_API_KEY="<your-key>"

or

you can setup api key in your ~/.bashrc or ~/.zshrc which I highly don't recommend

  • Inside Config:
{
    api = {
        apikeys = {
            GEMINI_API_KEY = "<your-key>"
        }
    }
}

Config

return {
  "PyDevC/model-cmp.nvim",
  config = function()
    require("model_cmp").setup({
      requests = {
        delay_ms = 1000,
        max_retries = 5,
        timeout_ms = 300000,
      },
      api = {
        apikeys = {
          GEMINI_API_KEY = "<your-key>"
        }
        custom_url = {
          url = "http://127.0.0.1",
          port = "8080"
        }
      },

      virtualtext = {
        enable = false,
        type = "inline",

        style = { -- This is just a highlight group
          fg = "#b53a3a",
          italic = false,
          bold = false
        }

      },
    })
    vim.keymap.set("i", "<C-s>", "<cmd>ModelCmp capture first<CR>")
  end,
}

Support

support me!!! it is difficult to develop open source while searching for jobs. scan and support IMG-20250829-WA0012

About

Testing Autocomplete via various models. Only for neovim

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages