Get the FREE Ultimate OpenClaw Setup Guide →

gemini.nvim

gemini cli integration for neovim

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio zaucy-gemini.nvim node path/to/gemini.nvim/server.js \
  --env GEMINI_CLI_IDE_WORKSPACE_PATH="Path to the current MCP workspace root" \
  --env GEMINI_CLI_SYSTEM_SETTINGS_PATH="Path to the workspace-specific settings.json generated by the plugin" \
  --env GEMINI_CLI_IDE_SERVER_STDIO_ARGS="Arguments for the above STDIO command" \
  --env GEMINI_CLI_IDE_SERVER_STDIO_COMMAND="Command used for Gemini to talk back to Neovim via MCP"

How to use

gemini.nvim provides Neovim integration for the Gemini CLI. It does not spawn Gemini directly; instead, it configures environment variables and a workspace-specific settings file so that Gemini can communicate with Neovim through the MCP framework. The plugin registers tooling hooks and an RPC-based hook system with mcp.nvim, allowing Gemini to call tools like openDiff and closeDiff and to emit session events (BeforeTool, AfterModel, etc.). To use it, install both lazy.nvim (as shown in the README) and mcp.nvim, then add gemini.nvim as a dependency. Once loaded, Gemini can trigger Neovim-driven actions via the registered autocommands and the provided hook script, enabling a seamless IDE-like workflow inside Neovim when working with Gemini.

How to install

Prerequisites:

  • Neovim with LuaJIT support
  • A Neovim plugin manager (e.g., lazy.nvim)
  • Git installed

Installation steps:

  1. Install dependencies in your Neovim config (example with lazy.nvim):
{
  "zaucy/gemini.nvim",
  dependencies = {
    "zaucy/mcp.nvim",
  },
  opts = {},
}
  1. Ensure mcp.nvim is installed and configured in your Neovim setup. The MCP server will register tools/hooks for Gemini integration when the plugin loads.
  2. Launch Neovim and verify that Gemini integration initializes when opening a Gemini-enabled workspace. No separate Gemini daemon is spawned by this plugin; it prepares environment variables and settings for Gemini to communicate with Neovim via MCP.

Notes:

  • There is no standalone npm/uv/dock binary to install for gemini.nvim itself; it operates as a Neovim plugin that works through mcp.nvim.
  • If you want to customize the workspace settings or environment, adjust the GEMINI_CLI_* environment variables described in the README and plugin docs.

Additional notes

Tips and common issues:

  • Ensure mcp.nvim is loaded before gemini.nvim so that autocommands like McpServerCreated and McpServerDirChange trigger proper dynamic settings generation.
  • The plugin relies on environment variables to configure Gemini's IDE connection; set GEMINI_CLI_IDE_WORKSPACE_PATH to the active workspace root when switching projects.
  • Gemini's hooks (BeforeTool, AfterModel, etc.) are wired to Neovim via an internal RPC script; if you don’t see events firing, verify that the MCP server is registered correctly and that the workspace settings file is being generated at GEMINI_CLI_SYSTEM_SETTINGS_PATH.
  • If you encounter issues with diff viewing, confirm that Gemini permissions and Neovim RPC bindings are functioning in your environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers