An AI-assisted commit message generator for Neovim, designed to help you write clear and consistent commit messages directly from your editor.
- π€ AI-generated commit messages following common commit conventions
- π Automatic clipboard copy
- π Optional lazygit integration with auto-paste
- βοΈ Configurable behavior
- π― Simple command interface
Click to watch the full video on GitHub:
If the GIF doesn't load, use the direct link: assets/demo.mp4
- Neovim >= 0.8.0
- nvim-lua/plenary.nvim (required by CopilotChat)
- CopilotC-Nvim/CopilotChat.nvim
- GitHub Copilot authentication (requires GitHub Copilot subscription)
- Git (already installed on most systems)
- Optional: lazygit binary + kdheepak/lazygit.nvim (only if using
open_lazygit = true)
Before using CommitMate, you need to authenticate with GitHub Copilot:
- Ensure you have a GitHub Copilot subscription
- In Neovim, run:
:Copilot auth - Follow the authentication steps (browser login)
- Enable Copilot Chat in your GitHub settings
{
"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 π€"
})
EOFNote: To use lazygit integration, uncomment the kdheepak/lazygit.nvim line. See Optional: Lazygit Integration Setup below.
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/releasesAfter installation, enable it in your config:
require("commitmate").setup({
open_lazygit = true,
})" Generate AI commit message for staged changes
:CommitMate
" Test if plugin is loaded
:CommitMate ping-
Stage your changes:
git add . -
Run the command:
:CommitMate
-
The plugin will:
- Generate a commit message using AI
- Copy it to your clipboard
- Save it to
.git/COMMIT_EDITMSG
-
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
- Paste anywhere with
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 π€"
})By default, the commit message will be:
- β
Copied to clipboard (paste anywhere with
Ctrl+V/Cmd+V) - β
Saved to
.git/COMMIT_EDITMSG(auto-loaded bygit commit)
This allows you to use your preferred git workflow.
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
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" })Built with:
- CopilotChat.nvim - AI chat integration
- lazygit - Terminal UI for git
