Open Terseus opened 3 months ago
I was facing the same issue, no completion in Neogit commit buffers.
Until this is fixed, I made this very hackish workaround.
Add this to your config:
local source = require('cmp-conventionalcommits')
function source:is_available()
return vim.list_contains({'gitcommit', 'NeogitCommitMessage'}, 'gitcommit')
end
And then, in after/ftplugin/NeogitCommitMessage.lua
, copy the content of gitcommit.lua:
if vim.g.cmp_conventionalcommits_source_id ~= nil then
require('cmp').unregister_source(vim.g.cmp_conventionalcommits_source_id)
end
vim.g.cmp_conventionalcommits_source_id = require('cmp').register_source('conventionalcommits', require('cmp-conventionalcommits').new())
It's hackish as hell, but well, it works.
Right now the source is hard coded to work only with the filetype gitcommit, here:
This prevents to use this plugin source with other filetypes, which for example the one used by Neogit in its commit window, which is "NeogitCommitMessage".
Given that it's the user who has to configure the source using
cmp.setup.filetype
using nvim-cmp API I see no reason to lock it to a given filetype.Please correct me if I'm wrong.