Skip to main content

VimLM - LLM-powered Vim assistant

Project description

VimLM - Local LLM-Powered Coding Assistant for Vim

vimlm

LLM-powered coding companion for Vim, inspired by GitHub Copilot/Cursor. Integrates contextual code understanding, summarization, and AI assistance directly into your Vim workflow.

Features

  • Model Agnostic - Use any MLX-compatible model via a configuration file
  • Vim-Native UX - Intuitive keybindings and split-window responses
  • Deep Context - Understands code context from:
    • Current file
    • Visual selections
    • Referenced files
    • Project directory structure
  • Conversational Coding - Iterative refinement with follow-up queries
  • Air-Gapped Security - 100% offline - no APIs, no tracking, no data leaks

Requirements

  • Apple M-series chip
  • Python 3.12.8

Quick Start

Install:

pip install vimlm

Launch:

vimlm

or

vimlm path/to/your_file

This launches Vim with the LLM in a split window, ready to assist you.

Basic Usage

  1. From Normal Mode:

    • Ctrl-l: Adds current line + file to context
    • Example prompt: "Regex for removing html tags from item.content"
  2. From Visual Mode:

    • Select code → Ctrl-l: Adds selected block + current file to context
    • Example prompt: "Convert this to async/await syntax"
  3. Inline Commands:

!include: Adds specified outside files/folders to context: - !include (no path): Current folder - !include ~/scrap/jph00/hypermedia-applications.summ.md: Specific folder - !include ~/wtm/utils.py: Specific file - Example prompt: "AJAX-ify this app @ ~/scrap/jph00/hypermedia-applications.summ.md"

!deploy: Extract code blocks to files in user specified dir (current dir if none specified).

!continue: Lets the LLM resume the generation from where it had halted due to length limits.

!followup: Continue the thread (equivalent to Ctrl-j

  1. Follow-Up: After initial response:

    • Ctrl-j: Continue thread
    • Example follow-up: "In Manifest V3"
  2. **Code Extraction: Press Ctrl-p to choose a code block from the response and insert them into:

    • The last selected visual block (in Normal mode)
    • The current selection (in Visual mode)
    • Example workflow:
      1. Select a block of code in Visual mode.
      2. Prompt the LLM with Ctrl-l (e.g., "Convert this to async/await syntax").
      3. Once the response is generated, press Ctrl-p to replace the selected block with the extracted code.

Key Bindings

Binding Mode Action
Ctrl-l Normal/Visual Send current file + selection to LLM
Ctrl-j Normal Continue conversation
Ctrl-p Normal/Visual Replace the selection with generated code
Esc Prompt Cancel input

Advanced Configuration

VimLM uses a JSON config file with the following configurable parameters:

{
  "DEBUG": true,
  "LLM_MODEL": null,
  "NUM_TOKEN": 2000,
  "SEP_CMD": "!",
  "USE_LEADER": false
}

Custom Model Setup

  1. Browse models: MLX Community Models on Hugging Face

  2. Edit config file:

{
  "LLM_MODEL": "mlx-community/DeepSeek-R1-Distill-Qwen-7B-4bit"
}
  1. Save to:
~/vimlm/config.json
  1. Restart VimLM

Custom Keybinding

If you prefer using <Leader> in place of <Ctrl> for the ViMLM key bindings:

{
  "USER_LEADER": true
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vimlm-0.0.6.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vimlm-0.0.6-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file vimlm-0.0.6.tar.gz.

File metadata

  • Download URL: vimlm-0.0.6.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for vimlm-0.0.6.tar.gz
Algorithm Hash digest
SHA256 db5edda3a2c487e3905ec10c5be1ff3f091166da8bb7280b06f079917ffcc5a6
MD5 8a1f2ce3b4062bdf39734e43385d0325
BLAKE2b-256 1646358f5c37def979d6bc7bf0adf13bb125145d41883abe4bc24bfd14d0ca65

See more details on using hashes here.

File details

Details for the file vimlm-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: vimlm-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for vimlm-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0a0d9939e0348b489422b5bffd6d53b5871807d7709abb918bd20991a2e13e45
MD5 99f992baa0d941794a059cab6e59f2bf
BLAKE2b-256 254c8066283ace2dda1d96f53071fa74abe5db76857a0c73b89517aba1f01245

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page