Skip to content

An AI-assisted commit message generator following common commit conventions. 🀝

License

Notifications You must be signed in to change notification settings

ajatdarojat45/commitmate.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

CommitMate.nvim 🀝

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

{
  "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.

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.

" 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:

About

An AI-assisted commit message generator following common commit conventions. 🀝

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages