goose.nvim

MCP.Pizza Chef: azorng

goose.nvim is a Neovim client that integrates the Goose AI agent directly into the editor, enabling seamless AI-powered chat interactions. It captures editor context such as current files and selections to enrich prompts, supports persistent sessions tied to workspaces, and facilitates continuous conversations with the AI assistant. This client enhances developer workflows by embedding powerful AI capabilities without leaving Neovim.

Use This MCP client To

Chat with Goose AI inside Neovim using current file context Maintain persistent AI sessions per workspace for ongoing conversations Enhance code editing with AI suggestions based on selections Integrate AI chat workflows directly into Neovim editor Use AI to generate or refactor code without leaving the editor Capture editor context to improve AI prompt relevance Streamline coding tasks with embedded AI assistant interactions

README

πŸͺΏ goose.nvim

seamless neovim integration with goose - work with a powerful AI agent without leaving your editor

Neovim GitHub stars Last Commit

✨ Description

This plugin provides a bridge between neovim and the goose AI agent, creating a chat interface while capturing editor context (current file, selections) to enhance your prompts. It maintains persistent sessions tied to your workspace, allowing for continuous conversations with the AI assistant similar to what tools like Cursor AI offer.

Goose.nvim interface

πŸ“‘ Table of Contents

πŸ“‹ Requirements

πŸš€ Installation

Install the plugin with your favorite package manager. See the Configuration section below for customization options.

With lazy.nvim

{
  "azorng/goose.nvim",
  config = function()
    require("goose").setup({})
  end,
  dependencies = {
    "nvim-lua/plenary.nvim",
    {
      "MeanderingProgrammer/render-markdown.nvim",
      opts = {
        anti_conceal = { enabled = false },
      },
    }
  },
}

βš™οΈ Configuration

-- Default configuration with all available options
require('goose').setup({
  keymap = {
    global = {
      toggle = '<leader>gg',                 -- Open goose. Close if opened 
      open_input = '<leader>gi',             -- Opens and focuses on input window on insert mode
      open_input_new_session = '<leader>gI', -- Opens and focuses on input window on insert mode. Creates a new session
      open_output = '<leader>go',            -- Opens and focuses on output window 
      toggle_focus = '<leader>gt',           -- Toggle focus between goose and last window
      close = '<leader>gq',                  -- Close UI windows
      toggle_fullscreen = '<leader>gf',      -- Toggle between normal and fullscreen mode
      select_session = '<leader>gs',         -- Select and load a goose session
      goose_mode_chat = '<leader>gmc',       -- Set goose mode to `chat`. (Tool calling disabled. No editor context besides selections)
      goose_mode_auto = '<leader>gma'        -- Set goose mode to `auto`. (Default mode with full agent capabilities)

      diff = {
        open = '<leader>gd',                 -- Opens a diff tab of a modified file since the last goose prompt
        next = '<leader>g]',                 -- Navigate to next file diff
        prev = '<leader>g[',                 -- Navigate to previous file diff
        close = '<leader>gc',                -- Close diff view tab and return to normal editing
        revert_all = '<leader>gra',          -- Revert all file changes since the last goose prompt
        revert_this = '<leader>grt',         -- Revert current file changes since the last goose prompt
      }
    },
    window = {
      submit = '<cr>',                     -- Submit prompt
      close = '<esc>',                     -- Close UI windows
      stop = '<C-c>',                      -- Stop goose while it is running
      next_message = ']]',                 -- Navigate to next message in the conversation
      prev_message = '[[',                 -- Navigate to previous message in the conversation
      mention_file = '@',                  -- Pick a file and add to context. See File Mentions section
      toggle_pane = '<tab>',               -- Toggle between input and output panes
      prev_prompt_history = '<up>',        -- Navigate to previous prompt in history
      next_prompt_history = '<down>'       -- Navigate to next prompt in history
    }
  },
  ui = {
    window_width = 0.35,                   -- Width as percentage of editor width
    input_height = 0.15,                   -- Input height as percentage of window height
    fullscreen = false,                    -- Start in fullscreen mode (default: false)
    layout = "right",                      -- Options: "center" or "right"
    floating_height = 0.8,                 -- Height as percentage of editor height for "center" layout
    display_model = true,                  -- Display model name on top winbar
    display_goose_mode = true              -- Display mode on top winbar: auto|chat
  }
})

🧰 Usage

Available Actions

The plugin provides the following actions that can be triggered via keymaps, commands, or the Lua API:

Action Default keymap Command API Function
Open goose. Close if opened <leader>gg :Goose require('goose.api').toggle()
Open input window (current session) <leader>gi :GooseOpenInput require('goose.api').open_input()
Open input window (new session) <leader>gI :GooseOpenInputNewSession require('goose.api').open_input_new_session()
Open output window <leader>go :GooseOpenOutput require('goose.api').open_output()
Toggle focus goose / last window <leader>gt :GooseToggleFocus require('goose.api').toggle_focus()
Close UI windows <leader>gq :GooseClose require('goose.api').close()
Toggle fullscreen mode <leader>gf :GooseToggleFullscreen require('goose.api').toggle_fullscreen()
Select and load session <leader>gs :GooseSelectSession require('goose.api').select_session()
Stop goose while it is running <C-c> :GooseStop require('goose.api').stop()
Pick a file and add to context @ - -
Run prompt (continue session) - :GooseRun <prompt> require('goose.api').run("prompt")
Run prompt (new session) - :GooseRunNewSession <prompt> require('goose.api').run_new_session("prompt")
Navigate to next message ]] - -
Navigate to previous message [[ - -
Navigate to previous prompt in history <up> - require('goose.api').prev_history()
Navigate to next prompt in history <down> - require('goose.api').next_history()
Toggle input/output panes <tab> - -
Open diff view of changes <leader>gd :GooseDiff require('goose.api').diff()
Navigate to next file diff <leader>g] :GooseDiffNext require('goose.api').next_diff()
Navigate to previous file diff <leader>g[ :GooseDiffPrev require('goose.api').prev_diff()
Close diff view tab <leader>gc :GooseDiffClose require('goose.api').close_diff()
Revert all file changes <leader>gra :GooseRevertAll require('goose.api').revert_all()
Revert current file changes <leader>grt :GooseRevertThis require('goose.api').revert_this()

πŸ“ Context

The following editor context is automatically captured and included in your conversations.

Context Type Description
Current file Path to the focused file before entering goose
Selected text Text and lines currently selected in visual mode
Mentioned files File info added through mentions

Adding more files to context through file mentions

You can reference files in your project directly in your conversations with Goose. This is useful when you want to ask about or provide context about specific files. Type @ in the input window to trigger the file picker. Supported pickers include fzf-lua, telescope, mini.pick, snacks

πŸ”§ Setting up goose

If you're new to goose:

  1. What is Goose?

    • Goose is an AI agent developed by Block (the company behind Square, Cash App...)
    • It offers powerful AI assistance with extensible configurations such as LLMs and MCP servers
  2. Installation:

    • Visit Install Goose for installation and configuration instructions
    • Ensure the goose command is available after installation
  3. Configuration:

    • Run goose configure to set up your LLM provider (Claude 3.7 Sonnet is recommended)

goose.nvim FAQ

How does goose.nvim capture context from Neovim?
It extracts current file content and selections to enrich AI prompts for more relevant responses.
Can I maintain multiple AI chat sessions in goose.nvim?
Yes, sessions are persistent and tied to your workspace, allowing continuous conversations.
Does goose.nvim require an external AI service?
Yes, it connects to the Goose AI agent backend to process chat interactions.
Is goose.nvim limited to specific programming languages?
No, it works with any language supported by Neovim, leveraging context from your files.
How do I install goose.nvim?
Install it as a Neovim plugin via your preferred plugin manager and configure it to connect to Goose AI.
Can goose.nvim work offline?
No, it requires network access to communicate with the Goose AI agent backend.
Which LLM providers does goose.nvim support?
Goose.nvim primarily integrates with the Goose AI agent but can be extended to support others like OpenAI, Claude, and Gemini.