Skip to main content
Glama

vim_mark

Set named marks at specific line and column positions in a text buffer using a single lowercase letter for identification, enabling precise navigation and editing.

Instructions

Set named marks at specific positions in the buffer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnYesThe column number where the mark should be placed (0-indexed)
lineYesThe line number where the mark should be placed (1-indexed)
markYesSingle lowercase letter [a-z] to use as the mark name

Implementation Reference

  • The MCP tool handler function for 'vim_mark' that calls NeovimManager.setMark and returns standardized content response or error message.
    async ({ mark, line, column }) => { try { const result = await neovimManager.setMark(mark, line, column); return { content: [{ type: "text", text: result }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : 'Error setting mark' }] }; } }
  • Zod schema defining input parameters for the vim_mark tool: mark (lowercase letter), line and column numbers.
    { mark: z.string().regex(/^[a-z]$/).describe("Single lowercase letter [a-z] to use as the mark name"), line: z.number().describe("The line number where the mark should be placed (1-indexed)"), column: z.number().describe("The column number where the mark should be placed (0-indexed)") },
  • src/index.ts:215-241 (registration)
    Registration of the 'vim_mark' tool on the MCP server, including name, description, input schema, and handler.
    server.tool( "vim_mark", "Set named marks at specific positions in the buffer", { mark: z.string().regex(/^[a-z]$/).describe("Single lowercase letter [a-z] to use as the mark name"), line: z.number().describe("The line number where the mark should be placed (1-indexed)"), column: z.number().describe("The column number where the mark should be placed (0-indexed)") }, async ({ mark, line, column }) => { try { const result = await neovimManager.setMark(mark, line, column); return { content: [{ type: "text", text: result }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : 'Error setting mark' }] }; } } );
  • Supporting method in NeovimManager that validates the mark name and executes the Vim 'mark' command followed by cursor positioning to the specified location.
    public async setMark(mark: string, line: number, col: number): Promise<string> { if (!/^[a-z]$/.test(mark)) { return 'Invalid mark name (must be a-z)'; } try { const nvim = await this.connect(); await nvim.command(`mark ${mark}`); const window = await nvim.window; await (window.cursor = [line, col]); return `Mark ${mark} set at line ${line}, column ${col}`; } catch (error) { console.error('Error setting mark:', error); return 'Error setting mark'; } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bigcodegen/mcp-neovim-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server