{"id":25527114,"url":"https://github.com/josefalbers/vimlm","last_synced_at":"2025-05-16T07:03:50.264Z","repository":{"id":276689038,"uuid":"929674550","full_name":"JosefAlbers/VimLM","owner":"JosefAlbers","description":"AI Copilot for Vim/NeoVim","archived":false,"fork":false,"pushed_at":"2025-02-28T10:58:12.000Z","size":15909,"stargazers_count":218,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T10:21:28.758Z","etag":null,"topics":["autocomplete","chat","copilot","fill-in-the-middle","llm","mlx","mlx-lm","neovim","neovim-plugin","vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JosefAlbers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-09T05:18:55.000Z","updated_at":"2025-04-18T00:23:25.000Z","dependencies_parsed_at":"2025-02-09T21:29:20.950Z","dependency_job_id":"0a09689b-f887-4515-b171-989e132c6563","html_url":"https://github.com/JosefAlbers/VimLM","commit_stats":null,"previous_names":["josefalbers/vimlm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosefAlbers%2FVimLM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosefAlbers%2FVimLM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosefAlbers%2FVimLM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosefAlbers%2FVimLM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JosefAlbers","download_url":"https://codeload.github.com/JosefAlbers/VimLM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485053,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomplete","chat","copilot","fill-in-the-middle","llm","mlx","mlx-lm","neovim","neovim-plugin","vim","vim-plugin"],"created_at":"2025-02-19T22:17:11.772Z","updated_at":"2025-05-16T07:03:50.200Z","avatar_url":"https://github.com/JosefAlbers.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VimLM - AI-Powered Coding Assistant for Vim/NeoVim\n\n![VimLM Demo](https://raw.githubusercontent.com/JosefAlbers/VimLM/main/assets/captioned_vimlm.gif)\n\nVimLM brings the power of AI directly into your Vim workflow. Maintain focus with keyboard-driven interactions while leveraging AI for code generation, refactoring, and documentation.\n\nGet started quickly with the [tutorial](tutorial.md).\n\n## Features\n- **Native Vim Integration** - Split-window responses \u0026 intuitive keybindings\n- **Offline First** - 100% local execution with MLX-compatible models\n- **Contextual Awareness** - Integrates seamlessly with your codebase and external resources\n- **Conversational Workflow** - Iterate on responses with follow-up queries\n- **Project Scaffolding** - Generate and deploy code blocks to directories\n- **Extensible** - Create custom LLM workflows with command chains\n\n## Requirements\n- Apple Silicon (M-series)\n- Python v3.12.8\n- Vim v9.1 or NeoVim v0.10.4\n\n## Quick Start\n```bash\npip install vimlm\nvimlm\n```\n\n## Smart Autocomplete  \n\n### **Basic Usage**\n\n| Key Binding | Mode    | Action                                  |  \n|-------------|---------|-----------------------------------------|  \n| `Ctrl-l`    | Insert  | Generate code suggestion                |  \n| `Ctrl-p`    | Insert  | Insert generated code                   |  \n| `Ctrl-j`    | Insert  | Generate and insert code                |\n\n*Example Workflow*:  \n1. Place cursor where you need code  \n```python\ndef quicksort(arr):\n    if len(arr) \u003c= 1:\n        return arr\n    pivot = arr[len(arr) // 2]\n    # \u003cCursor here\u003e\n    middle = [x for x in arr if x == pivot]\n    right = [x for x in arr if x \u003e pivot]\n    return quicksort(left) + middle + quicksort(right)\n```\n\n2. Use `Ctrl-j` to autocomplete\n\n### **Repository-Level Code Completion**\n\n| Option     | Description                              |\n|------------|------------------------------------------|\n| `--repo`   | Paths to include as repository context   |\n\nThe `--repo` option enhances autocomplete by providing repository-level context to the LLM.\n\n*Example Workflow*:\n1. Launch VimLM with repo context: `vimlm main.py --repo utils/*`\n2. In Insert mode, place cursor where completion is needed\n3. `Ctrl-l` to generate suggestions informed by repository context\n4. `Ctrl-p` to accept and insert the code\n\n## Conversational Assistance\n\n| Key Binding | Mode          | Action                                 |\n|-------------|---------------|----------------------------------------|\n| `Ctrl-l`    | Normal/Visual | Prompt LLM                             |\n| `Ctrl-j`    | Normal        | Continue conversation                  |\n| `Ctrl-p`    | Normal/Visual | Import generated code                  |\n| `Esc`       | Prompt        | Cancel input                           |\n\n### 1. **Contextual Prompting**\n`Ctrl-l` to prompt LLM with context:\n- Normal mode: Current file + line\n- Visual mode: Current file + selected block\n\n*Example Prompt*: `Create a Chrome extension`\n\n### 2. **Conversational Refinement**\n`Ctrl-j` to continue current thread.\n\n*Example Prompt*: `Use manifest V3 instead`\n\n### 3. **Code Substitution**\n`Ctrl-p` to insert generated code block\n- In Normal mode: Into last visual selection\n- In Visual mode: Into current visual selection \n\n*Example Workflow*:  \n1. Select a block of code in Visual mode  \n2. Prompt with `Ctrl-l`: `Use regex to remove html tags from item.content`  \n3. Press `Ctrl-p` to replace selection with generated code  \n\n## Inline Directives\n```text\n:VimLM [PROMPT] [!command1] [!command2]...\n```\n\n`!` prefix to embed inline directives in prompts:\n\n| Directive        | Description                                |\n|------------------|--------------------------------------------|\n| `!include PATH`  | Add file/directory/shell output to context |\n| `!deploy DEST`   | Save code blocks to directory              |\n| `!continue N`    | Continue stopped response                  |\n| `!followup`      | Continue conversation                      |\n\n### 1. **Context Layering**\n```text\n!include [PATH]  # Add files/folders to context\n```\n- **`!include`** (no path): Current folder  \n- **`!include ~/projects/utils.py`**: Specific file  \n- **`!include ~/docs/api-specs/`**: Entire folder  \n- **`!include $(...)`**: Shell command output\n\n*Example*: `Summarize recent changes !include $(git log --oneline -n 50)`\n\n### 2. **Code Deployment**\n```text\n!deploy [DEST_DIR]  # Extract code blocks to directory\n```\n- **`!deploy`** (no path): Current directory  \n- **`!deploy ./src`**: Specific directory  \n\n*Example:* `Create REST API endpoint !deploy ./api`\n\n### 3. **Extending Response**\n```text\n!continue [MAX_TOKENS]  # Continue stopped response\n```\n- **`!continue`**: Default 2000 tokens  \n- **`!continue 3000`**: Custom token limit  \n\n*Example:* `tl;dr !include large-file.txt !continue 5000`\n\n## Command-Line Mode\n```vim\n:VimLM prompt [!command1] [!command2]...\n```\n\nSimplify complex tasks by chaining multiple commands together into a single, reusable Vim command.\n\n*Examples*:\n```vim\n\" Debug CI failures using error logs\n:VimLM Fix Dockerfile !include .gitlab-ci.yml !include $(tail -n 20 ci.log)\n\n\" Generate unit tests for selected functions and save to test/\n:VimLM Write pytest tests for this !include ./src !deploy ./test\n\n\" Add docstrings to all Python functions in file\n:VimLM Add Google-style docstrings !include % !continue 4000\n```\n\n## Configuration\n\n### 1. **Model Settings**\nEdit `~/vimlm/cfg.json`:\n```json\n{\n  \"LLM_MODEL\": \"mlx-community/DeepSeek-R1-Distill-Qwen-7B-4bit\",\n  \"NUM_TOKEN\": 32768\n}\n```\n\n### 2. **Key Customization**\n```json\n{\n  \"USE_LEADER\": true,\n  \"KEY_MAP\": {\n    \"l\": \"]\",\n    \"j\": \"[\",\n    \"p\": \"p\" \n  }\n}\n```\n\n## License\n\nApache 2.0 - See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosefalbers%2Fvimlm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosefalbers%2Fvimlm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosefalbers%2Fvimlm/lists"}