reload_all_buffers
Reload all open buffers that have changed on disk after external file edits to maintain current content in Neovim.
Instructions
Check all open buffers and reload any that have changed on disk. Use this after editing files externally.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- lib/nvim-operations.js:209-238 (handler)The core handler function that finds Neovim instances, runs 'checktime' command to reload changed buffers, and returns a summary of checked buffers.export async function reloadAllBuffers() { const instances = await getNvimInstancesInCwd(); const reloadedBuffers = []; for (const { nvim } of instances) { try { // Use checktime to reload all buffers that have changed on disk await nvim.command("checktime"); const buffers = await nvim.buffers; for (const buf of buffers) { const listed = await nvim.call("buflisted", [buf.id]); if (listed) { const name = await buf.name; if (name) { reloadedBuffers.push(name); } } } } catch (error) { console.error("Error reloading buffers:", error.message); } } return { success: true, message: `Checked ${reloadedBuffers.length} buffer(s) for changes`, buffers: reloadedBuffers, }; }
- index.js:178-186 (schema)Tool schema definition in the list tools handler, specifying the tool name, description, and empty input schema (no parameters required).{ name: "reload_all_buffers", description: "Check all open buffers and reload any that have changed on disk. Use this after editing files externally.", inputSchema: { type: "object", properties: {}, }, },
- index.js:269-279 (registration)Registration and dispatch logic in the CallToolRequest handler that invokes the reloadAllBuffers function and formats the response.if (name === "reload_all_buffers") { const result = await reloadAllBuffers(); return { content: [ { type: "text", text: result.message, }, ], }; }