3.1 KiB
3.1 KiB
name, description, trigger
| name | description | trigger |
|---|---|---|
| nvim_editing | Route code edits to Neovim buffers instead of disk/console when Neovim is running. | always_on |
Neovim Code Editing
Never Spawn Headless Instances (CRITICAL)
NEVER run nvim <filename> via bash/terminal commands (run_command) to "open" or "show" a file to the user. Because agent terminal commands run in the background, this spawns an invisible ghost process.
If the user asks to "open", "show", or "see" a file in Neovim, you MUST use the win-nvim (Neovim) MCP Server to communicate with their active UI (e.g., using nvim_execute_lua with vim.cmd('edit <file>')).
When making code edits or displaying search results/outputs:
- Verify if the
win-nvim(Neovim) MCP server is responsive. - If Neovim is running, apply code changes directly into the relevant Neovim buffers using nvim_execute_lua (e.g., using vim.api.nvim_buf_set_lines or vim.cmd).
- DO NOT output large diffs or file contents to the chat console. Prefer live buffer manipulation over replace_file_content if the file is open in Neovim.
- Fallback Constraint (CRITICAL): If Neovim is NOT running, you MUST use the
replace_file_contenttool to edit files. This ensures the user is presented with a visual diff block in the chat. NEVER usesed,awk, orechoto blindly modify file contents from the terminal.
Visual Cues & Auto-Save Policy (MANDATORY)
When manipulating buffers via Lua, you MUST provide visual feedback:
- Notifications: Always trigger a notification explaining what you did using
require("notify")("Antigravity edited [File]: [Summary]", "info", { title = "Antigravity" })(sincercarriga/nvim-notifyandnoice.nvimare installed). - Buffer Focus: Always switch the active Neovim window to the buffer you just edited (e.g.,
vim.cmd('b ' .. bufnr)). - Cursor Jump: Move the cursor to the line you edited (
vim.api.nvim_win_set_cursor(0, {line, 0})). - Auto-Save by Default: You MUST save the buffer (
vim.cmd('write')) after making edits so that external tools (tests, compilers, linters, git) can see the changes immediately and unattended tasks are not stalled. - Interactive Review Mode (Exception): The ONLY time you should disable auto-save (leaving the buffer modified and unsaved) is when you are actively halting execution to seek manual user confirmation for a highly sensitive change. This allows the user to visually review the
gitsignsdiff in the gutter before manually saving (:w).
Interactive Review & Automatic Wakeup (MANDATORY)
When you modify a buffer and disable auto-save to allow the user to visually review the changes, you MUST NOT just wait idly for them to chat back. You MUST spawn a background task to listen for their :w save event:
- Use the un_command tool to execute: curl -s "http://127.0.0.1:3000/events/wait?topic=nvim:save:$((Get-Item $File).FullName.Replace('', '/'))&session_id=$SessionId"
- Set WaitMsBeforeAsync to a low value (e.g., 500ms) so it goes to the background immediately.
- Stop calling tools and end your turn. When the user saves the file, the curl command will complete and the system will automatically wake you up to proceed.