Skip to main content
Glama

vim_window

Split, close, and navigate Neovim windows using commands like split, vsplit, only, close, and wincmd with h/j/k/l for efficient window management.

Instructions

Manage Neovim windows: split, close, and navigate between windows

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesWindow manipulation command: split or vsplit to create new window, only to keep just current window, close to close current window, or wincmd with h/j/k/l to navigate between windows

Implementation Reference

  • Core handler function that validates the command and executes it directly on the Neovim instance using nvim.command().
    public async manipulateWindow(command: string): Promise<string> {
      const validCommands = ['split', 'vsplit', 'only', 'close', 'wincmd h', 'wincmd j', 'wincmd k', 'wincmd l'];
      if (!validCommands.some(cmd => command.startsWith(cmd))) {
        return 'Invalid window command';
      }
    
      try {
        const nvim = await this.connect();
        await nvim.command(command);
        return 'Window command executed';
      } catch (error) {
        console.error('Error manipulating window:', error);
        return 'Error executing window command';
      }
    }
  • src/index.ts:188-213 (registration)
    MCP server registration of the 'vim_window' tool, including description, input schema, and wrapper handler that calls the core implementation.
    server.tool(
      "vim_window",
      "Manage Neovim windows: split, close, and navigate between windows",
      { 
        command: z.enum(["split", "vsplit", "only", "close", "wincmd h", "wincmd j", "wincmd k", "wincmd l"])
          .describe("Window manipulation command: split or vsplit to create new window, only to keep just current window, close to close current window, or wincmd with h/j/k/l to navigate between windows")
      },
      async ({ command }) => {
        try {
          const result = await neovimManager.manipulateWindow(command);
          return {
            content: [{
              type: "text",
              text: result
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : 'Error manipulating window'
            }]
          };
        }
      }
    );
  • Zod input schema defining the allowed 'command' enum values for the vim_window tool.
    { 
      command: z.enum(["split", "vsplit", "only", "close", "wincmd h", "wincmd j", "wincmd k", "wincmd l"])
        .describe("Window manipulation command: split or vsplit to create new window, only to keep just current window, close to close current window, or wincmd with h/j/k/l to navigate between windows")
    },
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