CommitMate.nvim ๐Ÿค

December 21, 2025 ยท View on GitHub

An AI-assisted commit message generator for Neovim, designed to help you write clear and consistent commit messages directly from your editor.

โœจ Features

  • ๐Ÿค– AI-generated commit messages following common commit conventions
  • ๐Ÿ“‹ Automatic clipboard copy
  • ๐Ÿš€ Optional lazygit integration with auto-paste
  • โš™๏ธ Configurable behavior
  • ๐ŸŽฏ Simple command interface

๐ŸŽฌ Demo

Click to watch the full video on GitHub:

CommitMate demo

If the GIF doesn't load, use the direct link: assets/demo.mp4

๐Ÿ“‹ Requirements

GitHub Copilot Authentication

Before using CommitMate, you need to authenticate with GitHub Copilot:

  1. Ensure you have a GitHub Copilot subscription
  2. In Neovim, run: :Copilot auth
  3. Follow the authentication steps (browser login)
  4. Enable Copilot Chat in your GitHub settings

๐Ÿ“ฆ Installation

lazy.nvim

{
  "ajatdarojat45/commitmate.nvim",
  lazy = false,
  dependencies = {
    "nvim-lua/plenary.nvim",
    "CopilotC-Nvim/CopilotChat.nvim",
  },
  config = function()
    require("commitmate").setup({
      open_lazygit = false,  -- Auto-open lazygit (default: false)
      ping_message = "CommitMate.nvim is ready ๐Ÿค"  -- Custom ping message
    })
  end,
}

Note: To use lazygit integration, add "kdheepak/lazygit.nvim" to dependencies. See Optional: Lazygit Integration Setup below.

packer.nvim

use {
  "ajatdarojat45/commitmate.nvim",
  requires = {
    "nvim-lua/plenary.nvim",
    "CopilotC-Nvim/CopilotChat.nvim",
  },
  config = function()
    require("commitmate").setup({
      open_lazygit = false,
      ping_message = "CommitMate.nvim is ready ๐Ÿค"
    })
  end
}

Note: To use lazygit integration, add "kdheepak/lazygit.nvim" to requires. See Optional: Lazygit Integration Setup below.

vim-plug

" Dependencies
Plug 'nvim-lua/plenary.nvim'
Plug 'CopilotC-Nvim/CopilotChat.nvim'

" Optional: only if you want lazygit integration (open_lazygit = true)
" Plug 'kdheepak/lazygit.nvim'

" Plugin
Plug 'ajatdarojat45/commitmate.nvim'

" After plug#end(), add:
lua << EOF
require("commitmate").setup({
  open_lazygit = false,
  ping_message = "CommitMate.nvim is ready ๐Ÿค"
})
EOF

Note: To use lazygit integration, uncomment the kdheepak/lazygit.nvim line. See Optional: Lazygit Integration Setup below.

Optional: Lazygit Integration Setup

If you want to use the lazygit integration feature (open_lazygit = true), you need to install the lazygit binary on your system:

# macOS
brew install lazygit

# Ubuntu/Debian
sudo add-apt-repository ppa:jesseduffield/lazygit
sudo apt-get update
sudo apt-get install lazygit

# Or download from: https://github.com/jesseduffield/lazygit/releases

After installation, enable it in your config:

require("commitmate").setup({
  open_lazygit = true,
})

๐Ÿš€ Usage

Commands

" Generate AI commit message for staged changes
:CommitMate

" Test if plugin is loaded
:CommitMate ping

Basic Workflow

  1. Stage your changes:

    git add .
    
  2. Run the command:

    :CommitMate
    
  3. The plugin will:

    • Generate a commit message using AI
    • Copy it to your clipboard
    • Save it to .git/COMMIT_EDITMSG
  4. Use the commit message:

    • Paste anywhere with Ctrl+V/Cmd+V
    • Run git commit (automatically uses .git/COMMIT_EDITMSG)
    • Or enable lazygit integration for auto-commit workflow

Configuration Options

require("commitmate").setup({
  -- Auto-open lazygit with pre-filled commit message
  open_lazygit = false,  -- default: false
  
  -- Custom ping message
  ping_message = "CommitMate.nvim is ready ๐Ÿค"  -- default: "CommitMate.nvim is ready ๐Ÿค"
})

Default Behavior (open_lazygit = false)

By default, the commit message will be:

  • โœ… Copied to clipboard (paste anywhere with Ctrl+V/Cmd+V)
  • โœ… Saved to .git/COMMIT_EDITMSG (auto-loaded by git commit)

This allows you to use your preferred git workflow.

With lazygit Integration (open_lazygit = true)

For automatic lazygit workflow with pre-filled commit message:

require("commitmate").setup({
  open_lazygit = true,
})

With this setting, the plugin will:

  • Open lazygit automatically
  • Pre-fill the commit form with the generated message
  • Let you review and commit with one keypress

๐ŸŽฏ Keybinding Examples

Add these to your config for quick access:

-- lazy.nvim
{
  "ajatdarojat45/commitmate.nvim",
  keys = {
   { "<leader>cm", "<cmd>CommitMate<cr>", desc = "Generate commit message" },
  },
  -- ... rest of config
}

-- Or in your general keymaps
vim.keymap.set("n", "<leader>cm", "<cmd>CommitMate<cr>", { desc = "Generate commit message" })

๐Ÿ™ Credits

Built with: