From 0d9b138e6f0cdf2522aded6a53a71922796a3e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvar=20Hyv=C3=B6nen?= Date: Mon, 16 Oct 2023 14:36:28 +0300 Subject: [PATCH] Add new variable: `g:codeium_filetypes_disabled_by_default`. Enables finer control of when to enable codeium. --- README.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b868749b..720812c7 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ let g:codeium_disable_bindings = 1 or in Neovim: -```lua +```vim vim.g.codeium_disable_bindings = 1 ``` @@ -91,10 +91,10 @@ use { 'Exafunction/codeium.vim', config = function () -- Change '' here to any keycode you like. - vim.keymap.set('i', '', function () return vim.fn['codeium#Accept']() end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true }) + vim.keymap.set('i', '', function () return vim.fn['codeium#Accept']() end, { expr = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true }) + vim.keymap.set('i', '', function() return vim.fn['codeium#Clear']() end, { expr = true }) end } ``` @@ -116,21 +116,27 @@ let g:codeium_filetypes = { Codeium is enabled by default for most filetypes. -You can also _disable_ codeium by default with the `g:codeium_enabled` -variable: +You can also _disable_ codeium by default with the `g:codeium_enabled` variable, +and enable it manually per buffer by running `:CodeiumEnable`: ```vim let g:codeium_enabled = v:false ``` -or in Neovim: +Or you can disable codeium for _all filetypes_ with the `g:codeium_filetypes_disabled_by_default` variable, +and use the `g:codeium_filetypes` variable to selectively enable codeium for specified filetypes: -```lua -vim.g.codeium_enabled = false +```vim +" 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, + \ } ``` -Instead, if you would like to just disable the automatic triggering of -completions: +If you would like to just disable the automatic triggering of completions: ```vim let g:codeium_manual = v:true @@ -138,9 +144,8 @@ let g:codeium_manual = v:true ### Show Codeium status in statusline -Codeium status can be generated by calling the `codeium#GetStatusString()` function. In -Neovim, you can use `vim.api.nvim_call_function("codeium#GetStatusString", {})` instead. -It produces a 3 char long string with Codeium status: +Codeium status can be generated by calling `codeium#GetStatusString()` function. +It produce 3 char long string with status: - `'3/8'` - third suggestion out of 8 - `'0'` - Codeium returned no suggestions - `'*'` - waiting for Codeium response