Skip to main content
Glama

vim_jump

Easily navigate Neovim's jump list: move back, forward, or view all jumps using precise commands for efficient code editing and navigation.

Instructions

Navigate Neovim jump list: go back, forward, or list jumps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesJump direction or list jumps

Implementation Reference

  • src/index.ts:567-591 (registration)
    Registration of the 'vim_jump' MCP tool, including schema and handler function that delegates to NeovimManager
    server.tool(
      "vim_jump",
      "Navigate Neovim jump list: go back, forward, or list jumps",
      {
        direction: z.enum(["back", "forward", "list"]).describe("Jump direction or list jumps")
      },
      async ({ direction }) => {
        try {
          const result = await neovimManager.navigateJumpList(direction);
          return {
            content: [{
              type: "text",
              text: result
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : 'Error navigating jump list'
            }]
          };
        }
      }
    );
  • Handler function for vim_jump tool that invokes neovimManager.navigateJumpList and formats the response
    async ({ direction }) => {
      try {
        const result = await neovimManager.navigateJumpList(direction);
        return {
          content: [{
            type: "text",
            text: result
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : 'Error navigating jump list'
          }]
        };
      }
    }
  • Input schema for vim_jump tool using Zod validation
    {
      direction: z.enum(["back", "forward", "list"]).describe("Jump direction or list jumps")
    },
  • Core implementation of jump list navigation in NeovimManager class, handling back, forward, and list actions via Neovim API
    public async navigateJumpList(direction: string): Promise<string> {
      try {
        const nvim = await this.connect();
        
        switch (direction) {
          case 'back':
            await nvim.input('\x0f'); // Ctrl-O
            return 'Jumped back in jump list';
            
          case 'forward':
            await nvim.input('\x09'); // Ctrl-I (Tab)
            return 'Jumped forward in jump list';
            
          case 'list':
            await nvim.command('jumps');
            // Get the output from the command
            const output = await nvim.eval('execute("jumps")');
            return `Jump list:\n${output}`;
            
          default:
            throw new NeovimValidationError(`Unknown jump direction: ${direction}`);
        }
      } catch (error) {
        if (error instanceof NeovimValidationError) {
          throw error;
        }
        console.error('Error navigating jump list:', error);
        throw new NeovimCommandError(`jump ${direction}`, error instanceof Error ? error.message : 'Unknown error');
      }
    }
Install Server

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