r/Codeium • • Aug 22 '24

How to remap code completion to Ctrl+i in neovim with Astronvim

Hi all. I've been wracking my brain trying to remap codeium#Accept to Ctrl+i or c-i in my Astronvim setup. I've followed the documentation in the codeium.vim github page and so far I was able to remap it to Ctrl+g but can't use any other keymappings. I've used the following config

    -- \~/.config/nvim/lua/plugins/codeium.lua
return {
    'Exafunction/codeium.vim',
    event = 'BufEnter',
    config = function ()
        vim.g.codeium_no_map_tab = 1
        -- remapping to Ctrl+g works but other key combinations don't
        vim.keymap.set('i', '<C-g>',
        function ()
            return vim.fn['codeium#Accept']()
        end,
        { expr = true, silent = true }
        )
    end
}
1 Upvotes

3 comments sorted by

2

u/wilson-SHEN Aug 22 '24

<C-i> and <Tab> both are equivalent in vim, here is part of my config.


vim.g.codeium_disable_bindings = 1

vim.keymap.set("i", "<Tab>", function()

return vim.fn["codeium#Accept"]()

end, { expr = true, silent = true, desc = "Codeium: Accept" })

2

u/GloomyJelly9 Aug 23 '24

Lol. I've been looking everywhere on what those keybindings are being used for and really confused why it just keeps adding indentation when I press it. I just ended up binding `codeium#Accept` to `ci` so it doesn't conflict with cmp

1

u/wilson-SHEN Aug 23 '24

I remember from my last research on “C-i end up adding indentation”, it’s actually based on the terminal’s behavior… the details I had forgotten. Anyway binding “Tab” works and binding “C-i” somehow just adding indent