Conventional Commits source for blink.cmp completion plugin.
It provides the different types of conventional commits when writing a new Git commit message. Mainly because I am just starting to adopt conventional commits and can never remember the commonly used types.
example using Lazy plugin manager
{
'saghen/blink.cmp',
dependencies = {
{ 'disrupted/blink-cmp-conventional-commits' },
},
opts = {
sources = {
default = {
'conventional_commits', -- add it to the list
'lsp',
'buffer',
'path',
},
providers = {
conventional_commits = {
name = 'Conventional Commits',
module = 'blink-cmp-conventional-commits',
enabled = function()
return vim.bo.filetype == 'gitcommit'
end,
---@module 'blink-cmp-conventional-commits'
---@type blink-cmp-conventional-commits.Options
opts = {
-- See Configuration section below for available options
},
},
},
},
},
}The plugin provides several configuration options to customize the conventional commit types:
By default, the plugin provides the following conventional commit types:
feat- A new feature for the userfix- A bug fix for the userdocs- Documentation changesstyle- Changes that do not affect the meaning of the code (white-space, formatting, etc.)refactor- A code change that neither fixes a bug nor adds a featureperf- A code change that improves performancetest- Adding missing tests or correcting existing testschore- Changes to the build process or auxiliary tools and librariesci- Changes to CI/CD pipelinesrevert- Reverts a specific commit
opts = {
completion = {
-- Add custom commit types (will be merged with defaults)
items = {
{ type = 'custom', doc = 'My custom commit type' },
},
-- Set to false to disable default types and only use your custom ones
use_defaults = true, -- default: true
},
}Add your own custom types while keeping the defaults:
opts = {
completion = {
items = {
{ type = 'wip', doc = 'Work in progress' },
{ type = 'build', doc = 'Changes to build system' },
},
},
}Override specific default types with your own descriptions:
opts = {
completion = {
items = {
{ type = 'feat', doc = 'A new feature (customized description)' },
{ type = 'fix', doc = 'A bug fix (customized description)' },
},
},
}Disable all defaults and provide your own complete set:
opts = {
completion = {
use_defaults = false,
items = {
{ type = 'add', doc = 'Add new functionality' },
{ type = 'change', doc = 'Change existing functionality' },
{ type = 'remove', doc = 'Remove functionality' },
{ type = 'fix', doc = 'Fix a bug' },
},
},
}