-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
neovim: add custom gitcommit completion source
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
local cc = { | ||
{ | ||
label = 'build', | ||
documentation = 'Changes that affect the build system or external dependencies', | ||
}, | ||
{ | ||
label = 'chore', | ||
documentation = 'Other changes that dont modify src or test files', | ||
}, | ||
{ | ||
label = 'ci', | ||
documentation = 'Changes to our CI configuration files and scripts', | ||
}, | ||
{ | ||
label = 'docs', | ||
documentation = 'Documentation only changes', | ||
}, | ||
{ | ||
label = 'feat', | ||
documentation = 'A new feature', | ||
}, | ||
{ | ||
label = 'fix', | ||
documentation = 'A bug fix', | ||
}, | ||
{ | ||
label = 'perf', | ||
documentation = 'A code change that improves performance', | ||
}, | ||
{ | ||
label = 'refactor', | ||
documentation = 'A code change that neither fixes a bug nor adds a feature', | ||
}, | ||
{ | ||
label = 'style', | ||
documentation = 'Changes that do not affect the meaning of the code', | ||
}, | ||
{ | ||
label = 'test', | ||
documentation = 'Adding missing tests or correcting existing tests', | ||
}, | ||
} | ||
|
||
local items = {} | ||
for k, v in ipairs(cc) do | ||
items[k] = { | ||
label = v.label, | ||
kind = require('cmp').lsp.CompletionItemKind.Keyword, | ||
documentation = v.documentation, | ||
} | ||
end | ||
|
||
local source = {} | ||
|
||
function source:is_available() | ||
return vim.bo.filetype == 'gitcommit' | ||
end | ||
|
||
function source:complete(request, callback) | ||
callback(items) | ||
end | ||
|
||
require('cmp').register_source('gitcommit', source) |