-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmappings.lua
More file actions
45 lines (39 loc) · 1.38 KB
/
Copy pathmappings.lua
File metadata and controls
45 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- First, define the functions for insert mode actions
local function acceptCodeium()
return vim.fn["codeium#Accept"]()
end
local function cycleCompletionsForward()
return vim.fn["codeium#CycleCompletions"](1)
end
local function cycleCompletionsBackward()
return vim.fn["codeium#CycleCompletions"](-1)
end
local function clearCodeium()
return vim.fn["codeium#Clear"]()
end
-- Define a function for the normal mode toggle action
local function toggleCodeium()
if vim.g.codeium_enabled == true then
vim.cmd "CodeiumDisable"
else
vim.cmd "CodeiumEnable"
end
end
return {
n = { -- Normal mode mappings
["<space>"] = { "V", desc = "Enter visual line mode" },
["<space><space>"] = { "ggVG", desc = "Select all text" },
[";"] = {":", desc = "; -> :"},
},
v = { -- Normal mode mappings
[";"] = {":", desc = "; -> :"},
["<space><space>"] = { "ggVG", desc = "Select all text" },
},
i = { -- Insert mode mappings
["<Right>"] = {acceptCodeium, expr = true, desc = "Accept Codeium suggestion"},
["<C-Space>"] = {toggleCodeium, expr = true, desc = "Toggle Codeium"},
["<Up>"] = {cycleCompletionsForward, expr = true, desc = "Cycle Codeium completions forward"},
["<Down>"] = {cycleCompletionsBackward, expr = true, desc = "Cycle Codeium completions backward"},
["<Left>"] = {clearCodeium, expr = true, desc = "Clear Codeium suggestions"},
},
}