-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codeium-vim): port mappings to
astrocore
and fix lazy loading e…
…vent (#1077) * refactor(codeium-vim): port mappings to `astrocore` * feat(codeium-vim): add `cmd` and change `event` of the spec * feat(codeium-vim): use the `CodiumToggle` command to toggle the mapping
- Loading branch information
1 parent
3cbe80a
commit 5a7a7fa
Showing
1 changed file
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,45 @@ | ||
return { | ||
"Exafunction/codeium.vim", | ||
event = "User AstroFile", | ||
config = function() | ||
vim.keymap.set("i", "<C-g>", function() return vim.fn["codeium#Accept"]() end, { expr = true }) | ||
vim.keymap.set("i", "<c-;>", function() return vim.fn["codeium#CycleCompletions"](1) end, { expr = true }) | ||
vim.keymap.set("i", "<c-,>", function() return vim.fn["codeium#CycleCompletions"](-1) end, { expr = true }) | ||
vim.keymap.set("i", "<c-x>", function() return vim.fn["codeium#Clear"]() end, { expr = true }) | ||
vim.keymap.set("n", "<Leader>;", function() | ||
if vim.g.codeium_enabled == true then | ||
vim.cmd "CodeiumDisable" | ||
else | ||
vim.cmd "CodeiumEnable" | ||
end | ||
end, { noremap = true, desc = "Toggle Codeium active" }) | ||
end, | ||
cmd = { | ||
"Codeium", | ||
"CodeiumEnable", | ||
"CodeiumDisable", | ||
"CodeiumToggle", | ||
"CodeiumAuto", | ||
"CodeiumManual", | ||
}, | ||
event = "BufEnter", | ||
dependencies = { | ||
"AstroNvim/astrocore", | ||
---@type AstroCoreOpts | ||
opts = { | ||
mappings = { | ||
n = { | ||
["<Leader>;"] = { | ||
"<Cmd>CodeiumToggle<CR>", | ||
noremap = true, | ||
desc = "Toggle Codeium active", | ||
}, | ||
}, | ||
i = { | ||
["<C-g>"] = { | ||
function() return vim.fn["codeium#Accept"]() end, | ||
expr = true, | ||
}, | ||
["<C-;>"] = { | ||
function() return vim.fn["codeium#CycleCompletions"](1) end, | ||
expr = true, | ||
}, | ||
["<C-,>"] = { | ||
function() return vim.fn["codeium#CycleCompletions"](-1) end, | ||
expr = true, | ||
}, | ||
["<C-x>"] = { | ||
function() return vim.fn["codeium#Clear"]() end, | ||
expr = true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |