{"id":17724313,"url":"https://github.com/zutto/gpt.vim","last_synced_at":"2025-05-07T21:00:29.421Z","repository":{"id":180725895,"uuid":"665469318","full_name":"zutto/gpt.vim","owner":"zutto","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-15T07:47:07.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T14:10:27.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zutto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-07-12T09:18:44.000Z","updated_at":"2025-04-15T07:47:11.000Z","dependencies_parsed_at":"2024-10-25T20:07:24.067Z","dependency_job_id":"98a24e6f-8051-468c-b3a1-01cf5af404bd","html_url":"https://github.com/zutto/gpt.vim","commit_stats":null,"previous_names":["zutto/gpt.vim"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zutto%2Fgpt.vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zutto%2Fgpt.vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zutto%2Fgpt.vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zutto%2Fgpt.vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zutto","download_url":"https://codeload.github.com/zutto/gpt.vim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954376,"owners_count":21830902,"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":[],"created_at":"2024-10-25T15:46:30.019Z","updated_at":"2025-05-07T21:00:28.477Z","avatar_url":"https://github.com/zutto.png","language":"Vim Script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpt.vim\n\n(unfinished but working project, you may encounter problems.)\n\n\nA plugin for interfacing with general purpose text models, such as openai-chatgpt, localai, etc.\nWorks with vim and neovim.\n\n\n## TODO\n* Implement a localai backend as a demo back\n* Implement proper openai backend\n* Tidy the code and remove wonk\n* Reset function for the sessions\n* (MAYBE) option to change session on the fly to enable multiple contexts for the backend.\n* The `Gpt` command is quite wonky but seems useful, needs quite bit of fixing \u0026 rewriting.\n\n## Goals\n* vim \u0026 neovim compatible codebase\n* small \u0026 simple\n* Heavy lifting should be done by the \"backend\". Openai is not the only player anymore, local \u0026 private general purpose language models exist.\n* simple interface with the backends using pipes.\n\n\n## Requirements\n\nAn application that accepts a stdin stream of JSON. Such an application can be found at [github.com/zutto/python-chatgpt-vimbackend (WIP)](https://github.com/zutto/python-chatgpt-vimbackend), [github.com/mattn/chatgpt](https://github.com/mattn/chatgpt) or [sample bash backend](https://github.com/zutto/gpt.vim/tree/main/sample_bash_backend). You can also build your own simple piped handling.\n\nExample of the JSON stream:\n```\n{\"model\": \"gpt-4\", \"text\":\"Hello world\", \"systemrole\":\"custom role\", \"session\": \"\u003cname of session, optional\u003e\"}\n```\nSessions are just different chat sessions, so for completion you could use `completion` as session name, for chat just `chat`.\n\n\n\n\nExample of the output stream expected from the application:\n```\n{\"eof\": false, \"error\": \"\", \"text\": \"\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \"Hello\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \"!\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" How\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" can\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" I\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" assist\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" you\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \" today\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \"?\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \"\", notification: \"\"}\n{\"eof\": false, \"error\": \"\", \"text\": \"\", notification: \"\"}\n{\"eof\": true, \"error\": \"\", \"text\": \"\", notification: \"\"}\n```\n\nReset session (cleans the conversations, resets the underlying chatsession,\nreauthenticates, etc):\n```\n{\"model\": \"gpt-4\", \"text\":\"\"\", \"systemrole\":\"\",\"session\": \"\u003coptional\u003e\", \"reset\"=\"true\"}\n```\n\n\n\n## Settings\n\n- `g:chatgpt_bin` - Location of the program this plugin interfaces with. Default value: `['python3.11', '/usr/local/bin/chatgpt']`. Example: \n  ```vim\n  let g:chatgpt_bin = ['python3.11', '/usr/local/bin/chatgpt']\n  ```\n\n- `g:chatgpt_role` - Role to set for the assistant. This is a great place to use augroups to set different roles for different files. The program that interfaces with this plugin should handle updating the role for the assistant as needed. Example:\n  ```vim\n  let g:chatgpt_role = \"You are a helpful commit writer who likes to write easy to understand and compact commit messages.\"\n  ```\n- `g:chatgpt_role_completion` - same as `g:chatgpt_role` but for completion requests.\n\n## Commands\n\n- `Chatgpt` - Calls the assistant. Note: You highlight contents with visual mode. The highlighted contents will be sent to the assistant along with your request.\n\n- `Gpt` - Calls the assistant with completion session, using the completion role. This may be wonky, as this uses chat session for completion. Mainly made for fun.\n\n- `ChatgptSetRole` - Set a custom role on the fly.\n\n## Credits\n\nmattn's project was an inspiration for this project. This is basically a personal rewrite of the original project: [github.com/mattn/vim-chatgpt](https://github.com/mattn/vim-chatgpt). Give mattn all the love.\n\n## Demo\nnormal usage\n[![asciicast](https://asciinema.org/a/81jVCwHdEmEBSv00Lm71WHazk.svg)](https://asciinema.org/a/81jVCwHdEmEBSv00Lm71WHazk)\n\n\nExample of using visual mode.\n[![asciicast](https://asciinema.org/a/PVKHKSRIYOm7mvohAnCDIuDgB.svg)](https://asciinema.org/a/PVKHKSRIYOm7mvohAnCDIuDgB)\n\n\n\nGpt command demo\n[![asciicast](https://asciinema.org/a/Bn4VZP9qp2s2BerHj3TUmkiFE.svg)](https://asciinema.org/a/Bn4VZP9qp2s2BerHj3TUmkiFE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzutto%2Fgpt.vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzutto%2Fgpt.vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzutto%2Fgpt.vim/lists"}