Disabled by default, but respecting BufferEnable?
amadanmath opened this issue · comments
I wish to start with Codeium disabled globally, but to still allow me to enable it on a buffer-by-buffer basis. I thought vim.g.codeium_enabled = false
would do it, but after experimentation and delving into code, it seems that both global and buffer settings must be non-disabled. I would have expected that either of them being enabled would enable completion. In the end, starting off as enabled and setting a disabler autocommand seems to have worked (example for lazy.nvim
):
{
'Exafunction/codeium.vim',
event = { 'BufReadPost', 'BufNewFile' },
init = function()
local codeium_disabler_group = vim.api.nvim_create_augroup("codeium_disabler", { clear = true })
vim.api.nvim_create_autocmd({ 'BufReadPost', 'BufNewFile' }, {
group = codeium_disabler_group,
callback = function()
vim.cmd('Codeium DisableBuffer')
end,
})
end,
},
Is this the intended way to do it, or am I missing something simple?
+1 for this, I also like to disable Codeium in all buffers except a few file types.
Currently I'm doing this in vim9 as workaround
au BufReadPre * Codeium DisableBuffer
au Syntax go,python Codeium EnableBuffer
These don't work
// still enabled for file types that are not listed
let g:codeium_filetypes = {
\ '*': v:false,
\ 'go': v:true,
\ 'python': v:true,
\ }
// can't enable at all
let g:codeium_enabled = v:false
let g:codeium_filetypes = {
\ 'go': v:true,
\ 'python': v:true,
\ }
@12425 This feature was added in PRs: #252 and #344, make sure you have the latest version of the plugin.
" Not necessary to set enabled to true, as long as it's not set to false.
" let g:codeium_enabled = v:true
let g:codeium_filetypes_disabled_by_default = v:true
let g:codeium_filetypes = {
\ "rust": v:true,
\ "typescript": v:true,
\ }
The wildcard syntax could've been a good implementation option though :)