{"id":35835450,"url":"https://github.com/DanBradbury/copilot-chat.vim","last_synced_at":"2026-01-14T06:00:47.597Z","repository":{"id":282628587,"uuid":"948907116","full_name":"DanBradbury/copilot-chat.vim","owner":"DanBradbury","description":"Copilot Chat for Vim","archived":false,"fork":false,"pushed_at":"2025-12-29T18:08:25.000Z","size":814,"stargazers_count":119,"open_issues_count":15,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-01-01T03:59:12.133Z","etag":null,"topics":["ai","chatbot","copilot","vim","workflow"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanBradbury.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-15T08:21:21.000Z","updated_at":"2025-12-31T00:39:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec8d3936-7266-4c56-803e-715d7f9535d0","html_url":"https://github.com/DanBradbury/copilot-chat.vim","commit_stats":null,"previous_names":["danbradbury/copilot-chat.vim"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/DanBradbury/copilot-chat.vim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanBradbury%2Fcopilot-chat.vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanBradbury%2Fcopilot-chat.vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanBradbury%2Fcopilot-chat.vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanBradbury%2Fcopilot-chat.vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanBradbury","download_url":"https://codeload.github.com/DanBradbury/copilot-chat.vim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanBradbury%2Fcopilot-chat.vim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ai","chatbot","copilot","vim","workflow"],"created_at":"2026-01-08T00:00:40.805Z","updated_at":"2026-01-14T06:00:47.575Z","avatar_url":"https://github.com/DanBradbury.png","language":"Vim Script","funding_links":[],"categories":["AI Assistants"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Copilot Chat for Vim\n\n[![Vint](https://github.com/DanBradbury/copilot-chat.vim/actions/workflows/lint.yml/badge.svg)](https://github.com/DanBradbury/copilot-chat.vim/actions/workflows/lint.yml) [![Test](https://github.com/DanBradbury/copilot-chat.vim/actions/workflows/test.yml/badge.svg)](https://github.com/DanBradbury/copilot-chat.vim/actions/workflows/test.yml)\n\nCopilot Chat functionality without having to leave Vim.\n\nNvim folks will be able to use [CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim) for a similar experience.\n\n![copilotChat](https://github.com/user-attachments/assets/0cd1119d-89c8-4633-972e-641718e6b24b)\n\u003c/div\u003e\n\n## Requirements\n\n- [Vim\u003e9.0](https://github.com/vim/vim)\n- [NerdFonts](https://www.nerdfonts.com) (Optional for pretty icons)\n\n## Installation\n\nUsing [Vundle](https://github.com/VundleVim/Vundle.vim), [Pathogen](https://github.com/tpope/vim-pathogen) [vim-plug](https://github.com/junegunn/vim-plug), Vim 8+ packages, or any other plugin manager.\n\n### vundle\n\nAdd into `.vimrc` configuration.\n```vim\ncall vundle#begin()\nPlugin 'DanBradbury/copilot-chat.vim'\ncall vundle#end()\n\nfiletype plugin indent on\n```\n\n### Pathogen\n\nClone repository.\n```bash\ngit clone https://github.com/DanBradbury/copilot-chat.vim.git ~/.vim/bundle\n```\n\nAdd into `.vimrc` configuration.\n```vim\ncall pathogen#infect()\nsyntax on\nfiletype plugin indent on\n```\n\n### vim-plug\n\nAdd into `.vimrc` configuration.\n```vim\ncall plug#begin()\nPlug 'DanBradbury/copilot-chat.vim'\ncall plug#end()\n\nfiletype plugin indent on\n```\n\n### Vim 8+ packages\nClone repository.\n```bash\ngit clone https://github.com/DanBradbury/copilot-chat.vim.git ~/.vim/pack/plugins/start\n```\n\nAdd into `.vimrc` configuration.\n```vim\nfiletype plugin indent on\n```\n\n## Setup\n1. After installing the plugin, the first time you launch vim you'll be presented with the device registration page in your default browser.\n2. Follow the steps on the page and paste the Device Code when prompted.\n3. Once completed press `\u003cEnter\u003e` back in vim to complete the registration process.\n4. Start chatting with Copilot (`:CopilotChatOpen`, `:CopilotChat simple question`, etc)\n5. 🎉🎉🎉\n\n## Commands\n| Command | Description |\n| ------- | ----------- |\n| `:CopilotChat \u003cinput\u003e` | Launches a new Copilot chat with your input as the initial prompt |\n| `:CopilotChatOpen` | Opens a new Copilot chat window (default vsplit right) |\n| `:CopilotChatFocus` | Focuses the currently active chat window |\n| `:CopilotChatReset` | Resets the current chat window |\n| `:CopilotChatConfig` | Open `config.json` for default settings when opening a new CopilotChat window |\n| `:CopilotChatModels` | View available models / select active model |\n| `:CopilotChatSave \u003cname\u003e?` | Save chat history (uses timestamp if no name provided) |\n| `:CopilotChatLoad \u003cname\u003e?` | Load chat history (shows list of saved histories if no name provided) |\n| `:CopilotChatList` | List all saved chat histories |\n| `:CopilotChatSetActive \u003cbufnr\u003e?` | Sets the active chat window to the buffer number provided (default is the current buffer) |\n| `:CopilotChatUsage` | Show Copilot usage stats |\n\n## Plugin Keys\n| Key | Description |\n| ------- | ----------- |\n| `\u003cPlug\u003eCopilotChatAddSelection` | Copies selected text into active char buffer |\n\n## Default Key Mappings\n| Location | Insert | Normal | Visual | Action |\n| ---- | ---- | ---- | ---- | ---- |\n| Chat window| - | `\u003cCR\u003e` | - | Submit current prompt |\n| Models selection popup | - | `\u003cCR\u003e` | `\u003cSpace\u003e` | - | Select the model on the current line for future chat use |\n\n## User Key mappings\nThe plugin avoids adding any default vim key mappings to prevent conflict with\nother plugins and the users' own mappings.\n\nHowever, to easily work with the Copilot Chat plugin, the user might want to\nsetup his own vim key mappings. See example configuration below:\n\n```vim\n\" Open a new Copilot Chat window\nnnoremap \u003cleader\u003ecc :CopilotChatOpen\u003cCR\u003e\n\n\" Add visual selection to Copilot window\nvmap \u003cleader\u003ea \u003cPlug\u003eCopilotChatAddSelection\n```\n## Features\n\n### Autocomplete Macros\n\nThe plugin includes autocomplete macros, specifically designed to enhance productivity when working with file references.\n\n#### `/tab all` Macro\n![macros](https://github.com/user-attachments/assets/07c737e9-79f1-45e1-aa49-2729484b0e95)\n\n- Typing `/tab all` in the chat window will automatically expand into a list of all open tabs (excluding the current buffer) with their filenames prefixed by `#file:`.\n- The filenames are displayed in their relative path format, making it easier to reference files in your project.\n- If no other tabs are found, the message `No other tabs found` will be inserted instead.\n\n#### `#file:` Macro\n![filemacro](https://github.com/user-attachments/assets/f790f1a0-5cdf-4660-b602-349de5c229bc)\n\n- When typing `#file:` in the chat window, the plugin provides an autocomplete menu for file paths.\n- The autocomplete intelligently suggests files based on:\n  - Files tracked in the current Git repository (if inside a Git project).\n  - All files in the current working directory (if not in a Git project).\n- The suggestions exclude directories and only include files that match the text typed after `#file:`.\n- Example:\n  - Typing `#file:src/` will show a list of files in the `src/` directory.\n  - Selecting a file from the menu will insert its full path.\n\n### Model Selection\n`:CopilotChatModels` brings up a popup menu for of all the available models for you to choose from. Press `\u003cEnter\u003e` or `\u003cSpace\u003e` to select the highlighted model. New chats will use the selected model.\n\n### Add Selection to Chat\nBy default, this is configured to `\u003cLeader\u003ea` when in visual mode.\n- Adds the selection to the active chat window inside of a `\u0026filetype` named codeblock\n![](https://private-user-images.githubusercontent.com/2555073/423367966-e1aac0e2-0e95-4fdb-81d1-b92bb4b7cbf7.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDIxOTg4MTIsIm5iZiI6MTc0MjE5ODUxMiwicGF0aCI6Ii8yNTU1MDczLzQyMzM2Nzk2Ni1lMWFhYzBlMi0wZTk1LTRmZGItODFkMS1iOTJiYjRiN2NiZjcuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDMxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAzMTdUMDgwMTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjUyMTlmNDAxMjYyNzc5MjcwNmVlNTUwMDY2N2Q0NGVlMzY5OGUyM2U1MjgxMmQzOGI5ZTEwZDg2OGMzNzJkYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hckZ7Swx9wszWWgdduqTRnwtrqvUPMVhqSyoSdwTny4)\n\n### Chat History\nSave and restore your chat conversations with Copilot:\n\n#### Saving Chat History\n- Use `:CopilotChatSave \u003cname\u003e` to save the current chat history\n- If no name is provided, a timestamp will be used automatically\n- History files are stored in `~/.vim/copilot-chat/history/` as JSON files\n\n#### Loading Chat History\n- Use `:CopilotChatLoad \u003cname\u003e` to load a previously saved chat\n- If no name is provided, a list of available chat histories will be shown\n- You can also view all saved histories with `:CopilotChatList`\n\n### Prompt Templates\nCopilot Chat supports custom prompt templates that can be quickly accessed during chat sessions. Templates allow you to save frequently used prompts and invoke them with a simple syntax.\n\n#### Using Prompts\n- In the chat window, start a line with `\u003e PROMPT_NAME`\n- The `PROMPT_NAME` will be automatically replaced with the template content before sending to Copilot\n- Example: `\u003e explain` would expand to the full explanation template\n\n#### Managing Prompts\n1. Open the config with `:CopilotChatConfig`\n2. Add prompts to the `prompts` object in `config.json`:\n```json\n{\n  \"model\": \"gpt-4\",\n  \"prompts\": {\n    \"explain\": \"Explain how this code works in detail:\",\n    \"refactor\": \"Suggest improvements and refactoring for this code:\",\n    \"docs\": \"Generate documentation for this code:\"\n  }\n}\n```\n\n#### Example Usage\n```\n\u003e explain\n\nfunction validateUser() {\n  // code to validate\n}\n```\nThis will send the full template text + your code to Copilot.\n\n\n\n## Custom Configuration\n\nYou can customize the behavior of Copilot Chat by setting global variables in your `vimrc`.\n\n### Configuration Options\n\n| Variable | Description |\n|----------|-------------|\n| `g:copilot_chat_window_position` | Controls the split direction when opening a chat window. Valid values: `'right'` (default), `'left'`, `'top'`, `'bottom'`. Example: `let g:copilot_chat_window_position = 'bottom'`. Takes precedence over config.json. |\n| `g:copilot_chat_disable_mappings` | Set to 1 to disable the plugin's default mappings in the chat window. |\n| `g:copilot_chat_create_on_add_selection` | Set to 1 to create a new chat window when adding a visual selection if no chat window is open. If set to 0, no action is taken when no active chat window exists (default: 1). |\n| `g:copilot_chat_jump_to_chat_on_add_selection` | Set to 1 to jump to the chat window when adding a visual selection. If set to 0, the selection is added to the active chat window, but the user remains in the current window (default: 1). |\n| `g:copilot_reuse_active_chat` | Set to 1 to reuse the active chat window when opening a new chat window. If set to 0, a new chat window is always created. Adding selection is always appended to the active chat window, regardless of this setting (default: 1). |\n| `g:copilot_chat_data_dir` | Set to the directory where the plugin stores its data. By default, this is `~/.vim/copilot-chat/`. |\n| `g:copilot_chat_open_on_toggle` | Set to 0 to prevent a new chat window from opening when toggling the chat window. |\n| `g:copilot_list_chat_buffer` | By default, copilot-chat buffers are not listed. Set to 1 to change this behavior. |\n| `g:copilot_chat_message_history_limit` | Maximum number of messages to send to the API (default: 20). Limits context to improve performance with long chat histories. Set to a higher value if you need more context, or lower for better performance. |\n| `g:copilot_chat_syntax_debounce_ms` | Debounce delay in milliseconds for syntax highlighting (default: 300). Lower values update highlighting faster but use more CPU. Higher values improve performance but delay syntax updates. |\n| `g:copilot_chat_file_cache_timeout` | Cache timeout in seconds for file completion (default: 5). Lower values show new files faster but make more system calls. Higher values improve performance but delay showing new files. |\n\nFor example, to always open chats in a horizontal split at the bottom:\n\n```vim\nlet g:copilot_chat_window_position = 'bottom'\n```\n\n### Performance Tuning\n\nFor better performance with long chat sessions, you can adjust these settings:\n\n```vim\n\" Send only the last 10 messages for faster responses\nlet g:copilot_chat_message_history_limit = 10\n\n\" Increase debounce delay for slower machines (reduces CPU usage)\nlet g:copilot_chat_syntax_debounce_ms = 500\n\n\" Longer cache timeout for large projects (reduces system calls)\nlet g:copilot_chat_file_cache_timeout = 10\n```\n\n## Problems\n\nThe following error message means the logged in account does not\nhave Copilot activated:\n\n\u003e Resource not accessible by integration\n\n## Contributing\nPlease see the [contribution guide](./CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDanBradbury%2Fcopilot-chat.vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDanBradbury%2Fcopilot-chat.vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDanBradbury%2Fcopilot-chat.vim/lists"}