xonecas.io
7415
Va

vim-ai-complete / commit 18ebe44

chore: repo rename

xonecas2026-06-13 18ebe446e2cfbf9ed909464bf089100bb1051671 parent cf0655d

5 files changed

AGENTS.md+8−8
@@ -1,10 +1,10 @@
11 # AGENTS.md
22
3-Repository notes for coding agents working on `vim-pi-complete`.
3+Repository notes for coding agents working on `vim-ai-complete`.
44
55 ## Project overview
66
7-This is a minimal Neovim plugin that exposes `:Pi <prompt>` for AI-assisted edits. The user visually selects text, runs `:Pi`, and the plugin replaces the selection with stdout from the `pi` coding agent.
7+This is a minimal Neovim plugin that exposes `:Ai <prompt>` for AI-assisted edits. The user visually selects text, runs `:Ai`, and the plugin replaces the selection with stdout from the `pi` coding agent.
88
99 The plugin intentionally invokes `pi` in a constrained way:
1010
@@ -15,13 +15,13 @@ The plugin intentionally invokes `pi` in a constrained way:
1515
1616 ## Repository layout
1717
18-- `plugin/pi_complete.lua`
18+- `plugin/ai_complete.lua`
1919 - Neovim runtime entrypoint.
20- - Guards against double loading with `vim.g.loaded_pi_complete`.
21- - Defines the public `:Pi` command.
22- - Adds a lowercase `:pi` command-line abbreviation.
20+ - Guards against double loading with `vim.g.loaded_ai_complete`.
21+ - Defines the public `:Ai` command.
22+ - Adds a lowercase `:ai` command-line abbreviation.
2323
24-- `lua/pi_complete/init.lua`
24+- `lua/ai_complete/init.lua`
2525 - Main implementation module.
2626 - Builds the prompt sent to `pi`.
2727 - Captures the visual selection using register `z`.
@@ -37,7 +37,7 @@ The plugin intentionally invokes `pi` in a constrained way:
3737
3838 ## Important behavior to preserve
3939
40-- `:Pi` is selection-oriented. The current implementation relies on `gv` to restore the previous visual selection.
40+- `:Ai` is selection-oriented. The current implementation relies on `gv` to restore the previous visual selection.
4141 - Register `z` is temporary scratch space. Always save and restore its contents and type.
4242 - Failed `pi` calls should leave the buffer unchanged.
4343 - The generated text should be pasted using the original selection type: characterwise, linewise, or blockwise.
README.md+12−12
@@ -1,4 +1,4 @@
1-# vim-pi-complete
1+# vim-ai-complete
22
33 A simple Neovim plugin that mimics Cursor's selection prompt and Zed's editor assist feature using the pi coding agent's non-interactive mode.
44
@@ -8,7 +8,7 @@ Currently, the plugin expects `pi` to be installed and ready to use. The argumen
88
99 ## How to use
1010
11-Select a visual block, line, or selection, and then type `:Pi <your prompt here>`. The selection will be replaced with the model's output.
11+Select a visual block, line, or selection, and then type `:Ai <your prompt here>`. The selection will be replaced with the model's output.
1212 You can give any kind of prompt, but the agent has no edit tools, so it can only reply with the new text, and it is instructed to do so.
1313 There is no visual feedback on submit, but if an error occurs, you will see it.
1414
@@ -23,10 +23,10 @@ This plugin uses the standard Neovim plugin layout, so it should work with any p
2323 Add a plugin spec like this:
2424
2525 ```lua
26--- ~/.config/nvim/lua/plugins/pi-complete.lua
26+-- ~/.config/nvim/lua/plugins/ai-complete.lua
2727 return {
28- "sacenox/vim-pi-complete",
29- cmd = { "Pi" },
28+ "sacenox/vim-ai-complete",
29+ cmd = { "Ai" },
3030 }
3131 ```
3232
@@ -34,19 +34,19 @@ For local development, use `dir` instead:
3434
3535 ```lua
3636 return {
37- dir = "~/src/vim-pi-complete",
38- cmd = { "Pi" },
37+ dir = "~/src/vim-ai-complete",
38+ cmd = { "Ai" },
3939 }
4040 ```
4141
42-Note: when lazy-loading with `cmd = { "Pi" }`, the lowercase `:pi` abbreviation is only available after the plugin has loaded. Use `:Pi` to trigger loading, or define the abbreviation in `init`:
42+Note: when lazy-loading with `cmd = { "Ai" }`, the lowercase `:ai` abbreviation is only available after the plugin has loaded. Use `:Ai` to trigger loading, or define the abbreviation in `init`:
4343
4444 ```lua
4545 return {
46- "sacenox/vim-pi-complete",
47- cmd = { "Pi" },
46+ "sacenox/vim-ai-complete",
47+ cmd = { "Ai" },
4848 init = function()
49- vim.cmd([[cabbrev pi Pi]])
49+ vim.cmd([[cabbrev ai Ai]])
5050 end,
5151 }
5252 ```
@@ -57,7 +57,7 @@ Without a plugin manager:
5757
5858 ```bash
5959 cd ~/.config/nvim/pack/local/start
60-git clone https://github.com/sacenox/vim-pi-complete.git
60+git clone https://github.com/sacenox/vim-ai-complete.git
6161 ```
6262
6363 Then restart Neovim.
lua/ai_complete/init.lua+4−4
@@ -31,7 +31,7 @@ function M.complete(user_prompt, has_range)
3131 -- This command only makes sense when text is selected. If there is no range,
3232 -- show an error and stop before changing anything.
3333 if has_range == 0 then
34- vim.notify('pi-complete: select text visually first', vim.log.levels.ERROR)
34+ vim.notify('ai-complete: select text visually first', vim.log.levels.ERROR)
3535 return
3636 end
3737
@@ -52,7 +52,7 @@ function M.complete(user_prompt, has_range)
5252 local selected_type = vim.fn.getregtype('z')
5353
5454 -- Let the user know Neovim is about to block while pi generates a response.
55- vim.notify('Pi is generating...', vim.log.levels.INFO)
55+ vim.notify('ai-complete: generating...', vim.log.levels.INFO)
5656 vim.cmd('redraw')
5757
5858 -- Call the external `pi` program with a prompt built from the user instruction
@@ -77,7 +77,7 @@ function M.complete(user_prompt, has_range)
7777 -- the buffer unchanged.
7878 if vim.v.shell_error ~= 0 then
7979 vim.fn.setreg('z', old_z, old_z_type)
80- vim.notify('pi-complete: pi failed', vim.log.levels.ERROR)
80+ vim.notify('ai-complete: pi failed', vim.log.levels.ERROR)
8181 return
8282 end
8383
@@ -90,7 +90,7 @@ function M.complete(user_prompt, has_range)
9090 vim.fn.setreg('z', old_z, old_z_type)
9191
9292 -- Let the user know we are done.
93- vim.notify('Pi is done.', vim.log.levels.INFO)
93+ vim.notify('ai-complete: done.', vim.log.levels.INFO)
9494 vim.cmd('redraw')
9595 end
9696
plugin/ai_complete.lua+21−0
@@ -0,0 +1,21 @@
1+-- Guard against loading this plugin more than once in a Neovim session.
2+if vim.g.loaded_ai_complete == 1 then
3+ return
4+end
5+
6+-- Mark the plugin as loaded so re-sourcing the runtime files is a no-op.
7+vim.g.loaded_ai_complete = 1
8+
9+-- Define :Ai as the public entry point for invoking ai_complete.
10+-- Forward any command arguments and range information to the Lua module.
11+vim.api.nvim_create_user_command('Ai', function(opts)
12+ require('ai_complete').complete(opts.args, opts.range)
13+end, {
14+ -- Accept zero or more arguments after :Ai.
15+ nargs = '*',
16+ -- Allow :Ai to be called with a line range.
17+ range = true,
18+})
19+
20+-- Neovim user commands must start with uppercase, so :ai is a tiny alias.
21+vim.cmd([[cabbrev ai Ai]])
plugin/pi_complete.lua+0−21
@@ -1,21 +0,0 @@
1--- Guard against loading this plugin more than once in a Neovim session.
2-if vim.g.loaded_pi_complete == 1 then
3- return
4-end
5-
6--- Mark the plugin as loaded so re-sourcing the runtime files is a no-op.
7-vim.g.loaded_pi_complete = 1
8-
9--- Define :Pi as the public entry point for invoking pi_complete.
10--- Forward any command arguments and range information to the Lua module.
11-vim.api.nvim_create_user_command('Pi', function(opts)
12- require('pi_complete').complete(opts.args, opts.range)
13-end, {
14- -- Accept zero or more arguments after :Pi.
15- nargs = '*',
16- -- Allow :Pi to be called with a line range.
17- range = true,
18-})
19-
20--- Neovim user commands must start with uppercase, so :pi is a tiny alias.
21-vim.cmd([[cabbrev pi Pi]])