An AI-assisted commit message generator for Neovim, designed to help you write clear and consistent commit messages directly from your editor.
Click to watch the full video on GitHub:
If the GIF doesn't load, use the direct link: assets/demo.mp4
open_lazygit = true)Before using CommitMate, you need to authenticate with GitHub Copilot:
:Copilot auth{
"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.
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,
})
" 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:
.git/COMMIT_EDITMSGUse the commit message:
Ctrl+V/Cmd+Vgit commit (automatically uses .git/COMMIT_EDITMSG)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:
Ctrl+V/Cmd+V).git/COMMIT_EDITMSG (auto-loaded by git 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:
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: