Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled by default, but respecting BufferEnable? #324

Open
amadanmath opened this issue Mar 1, 2024 · 3 comments
Open

Disabled by default, but respecting BufferEnable? #324

amadanmath opened this issue Mar 1, 2024 · 3 comments

Comments

@amadanmath
Copy link

amadanmath commented Mar 1, 2024

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?

@12425
Copy link

12425 commented Apr 5, 2024

+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,
  \ }

@zArubaru
Copy link
Contributor

zArubaru commented Apr 5, 2024

@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 :)

@12425
Copy link

12425 commented Apr 6, 2024

@zArubaru Great, it works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants