Commit Scope Completer - intelligent scope suggestions for conventional commits in Neovim.

The Problem: When writing Conventional Commits, you need consistency in your scope names. Did you use auth or authentication? Was it ui or frontend? Without consistency, your git history becomes fragmented and less useful.
Existing Solutions Fall Short: While there are scope completions available (like those in commitizen or @commitlint), they require Node.js dependencies and project-specific configuration files. You shouldn't need to install a JavaScript toolchain just to get smart completions for your commit messages!
The csc.nvim Difference:
Unlike JavaScript-based solutions that require polluting your project with config files and node_modules, csc.nvim lives entirely in your editor, learning from your actual commit history.
type(|): description{
'hrsh7th/nvim-cmp',
dependencies = {
'yus-works/csc.nvim',
-- other sources...
},
config = function()
require('csc').setup()
require('cmp').setup.filetype('gitcommit', {
sources = {
{ name = 'csc' },
{ name = 'luasnip' }, -- optional but recommended (see "Works Great With" section)
}
})
end
}
use {
'hrsh7th/nvim-cmp',
requires = {
'yus-works/csc.nvim',
-- other sources...
},
config = function()
require('csc').setup()
require('cmp').setup.filetype('gitcommit', {
sources = {
{ name = 'csc' },
{ name = 'luasnip' }, -- optional but recommended (see "Works Great With" section)
}
})
end
}
Plug 'hrsh7th/nvim-cmp'
Plug 'yus-works/csc.nvim'
Then in your init.vim/init.lua after plug#end():
lua << EOF
require('csc').setup()
require('cmp').setup.filetype('gitcommit', {
sources = {
{ name = 'csc' },
{ name = 'luasnip' }, -- optional but recommended (see "Works Great With" section)
}
})
EOF
If you prefer to only load csc.nvim as a source to nvim-cmp, without the other functionality such as the helper commands and colorcolumns, you may replace:
require('csc').setup()
with
require('csc.cmp').register()
the completion suggestions will work exactly as before.
{
'saghen/blink.cmp',
dependencies = {
{ 'yus-works/csc.nvim', opts = {} },
-- other sources...
},
}
use {
'saghen/blink.cmp',
requires = {
{ 'yus-works/csc.nvim' },
-- other sources...
},
config = function()
require('csc').setup()
end
}
Plug 'saghen/blink.cmp'
Plug 'yus-works/csc.nvim'
Then in your init.vim/init.lua after plug#end():
lua << EOF
require('csc').setup()
EOF
If you prefer to only load csc.nvim as a source to blink.cmp, without the other functionality such as the helper commands and colorcolumns, you may drop the:
require('csc').setup()
-- or for lazy.nvim, the equivalent
opts = {}
the completion suggestions will work exactly as before.
The plugin automatically activates when editing git commit messages.
Start typing a conventional commit and get scope suggestions:
feat(|): add new feature
^ completion menu appears:
auth
api
ui
database
Also works with a breaking change indicator:
refactor(|)!: change api
^ completion menu appears:
auth
api
ui
database
Fuzzy matching (thanks to nvim-cmp/blink.cmp):
feat(db|): add new feature
^ completion menu appears:
database
debugger
If you're using LuaSnip with friendly-snippets, you get the best of both worlds:
feat, fix, docs, etc. to quickly start your commitrequire('csc').setup({
debug = false, -- enables printing debug messages
max_suggestions = 5, -- maximum number of scope suggestions returned (default: 10)
})
:CSC analyze - Analyze repository scope usage:CSC status - Show current buffer status:CSC help - Display available commandsNo suggestions appearing?
:CSC test_gitfeat(|)::CSC statusWrong scopes or missing recent commits?
:CSC analyze to see what scopes it foundStill having issues?
require('csc').setup({ debug = true }):messages for debug output:CSC help for more debugging commands