list_nvim_buffers
View all open buffers in Neovim instances within the current directory to manage editor content and track active files.
Instructions
List all open buffers in Neovim instances running in the current directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:198-208 (handler)Executes the list_nvim_buffers tool by calling listOpenBuffers() and returning the buffers as JSON text.if (name === "list_nvim_buffers") { const buffers = await listOpenBuffers(); return { content: [ { type: "text", text: JSON.stringify(buffers, null, 2), }, ], }; }
- index.js:114-121 (registration)Registers the list_nvim_buffers tool with its description and empty input schema in the ListToolsRequestSchema handler.name: "list_nvim_buffers", description: "List all open buffers in Neovim instances running in the current directory", inputSchema: { type: "object", properties: {}, }, },
- index.js:117-120 (schema)Defines the input schema for list_nvim_buffers tool (no required parameters).inputSchema: { type: "object", properties: {}, },
- lib/nvim-operations.js:95-122 (helper)Implements the core logic to list all open (listed) buffers across Neovim instances in the current working directory, returning array of {path, bufnr, cwd}.export async function listOpenBuffers() { const instances = await getNvimInstancesInCwd(); const allBuffers = []; for (const { nvim, cwd } of instances) { try { 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) { allBuffers.push({ path: name, bufnr: buf.id, cwd, }); } } } } catch (error) { console.error("Error listing buffers:", error.message); } } return allBuffers; }