add: codeium config

This commit is contained in:
asep.komarudin 2024-06-05 12:28:31 +07:00
parent 8677303d6d
commit a0c81f7286
10 changed files with 308 additions and 234 deletions

View file

@ -10,6 +10,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
"codeium.nvim": { "branch": "main", "commit": "d3b88eb3aa1de6da33d325c196b8a41da2bcc825" },
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
"dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" },
"friendly-snippets": { "branch": "main", "commit": "e11b09bf10706bb74e16e4c3d11b2274d62e687f" },
@ -21,10 +22,11 @@
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" },
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
"noice.nvim": { "branch": "main", "commit": "69c6ad5c1f1c0777125d0275f9871d8609cb0521" },
"noice.nvim": { "branch": "main", "commit": "29c7f030b0920e2f17263a9ab8742cde144b9140" },
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
"none-ls.nvim": { "branch": "main", "commit": "c2dd47284f5f800fe86a6f848de4114bc83408cf" },
"none-ls.nvim": { "branch": "main", "commit": "8691504118b252d64fc5023a104aedd100ab754a" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
@ -35,7 +37,7 @@
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" },
"nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
"nvim-treesitter": { "branch": "master", "commit": "a80fe081b4c5890980561e0de2458f64aaffbfc7" },
"nvim-treesitter": { "branch": "master", "commit": "69e41a2c1405ad9626ed502b86e75245f8118531" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "fd41b7ccc5490a3a99c734d1ee418b68d06c48a9" },
"nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },

View file

@ -109,9 +109,15 @@ vim.g.pcode_coderunner = {
vim.g.pcode_nvimtree_isfloat = 0
vim.g.pcode_tailwindcolorizer = false
-- https://github.com/Exafunction/codeium.vim
vim.g.pcode_codeium = false
-- https://github.com/Exafunction/codeium.nvim
vim.g.pcode_codeium_nvim = true
-- https://github.com/kevinhwang91/nvim-ufo
vim.g.pcode_nvimufo = false
vim.g.pcode_indentscope = false
-- https://github.com/echasnovski/mini.indentscope
vim.g.pcode_indentscope = true
-- https://github.com/echasnovski/mini.animate
vim.g.pvode_minianimate = false
vim.g.pcode_disable_cmpdoc = false

View file

@ -86,6 +86,7 @@ return {
luasnip = "(Snippet)",
buffer = "(Buffer)",
path = "(Path)",
codeium = "(Codeium)",
})[entry.source.name]
return vim_item
end,

View file

@ -3,8 +3,9 @@ if vim.g.pcode_codeium then
M.codeium = {
"Exafunction/codeium.vim",
enabled = true,
-- event = "BufEnter",
event = "InsertEnter",
version = "1.8.37",
event = "BufWinEnter",
-- event = "InsertEnter",
config = function()
vim.g.codeium_disable_bindings = 1
-- Change '<C-g>' here to any keycode you like.

View file

@ -0,0 +1,27 @@
if vim.g.pcode_codeium_nvim then
return {
-- codeium cmp source
{
"nvim-cmp",
dependencies = {
-- codeium
{
"Exafunction/codeium.nvim",
cmd = "Codeium",
build = ":Codeium Auth",
opts = {},
},
},
--@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "codeium",
group_index = 1,
priority = 100,
})
end,
},
}
else
return {}
end

View file

@ -24,4 +24,8 @@ _G.extract = function(text)
return result
end
_G.all_trim = function(s)
return s:match "^%s*(.-)%s*$"
end
return {}

View file

@ -10,7 +10,8 @@ return {
Collapsed = "",
Constant = "",
Constructor = "",
Copilot = "",
Copilot = "",
CopilotOff = "",
Enum = "",
EnumMember = "",
Event = "",

View file

@ -51,6 +51,35 @@ return {
cond = hide_in_width,
},
codeium = {
function()
if vim.g.pcode_codeium then
local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {}))
if codeium then
-- return " " .. all_trim(codeium)
if codeium == "OFF" then
return icons.kind.CopilotOff
else
return icons.kind.Copilot
end
else
return ""
end
else
return ""
end
end,
color = function()
if vim.g.pcode_codeium then
local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {}))
return { fg = codeium == "OFF" and "#3E4452" or "#50fa7b" }
else
return {}
end
end,
cond = hide_in_width,
},
-- Lsp info
lsp_info = {
function()

View file

@ -12,6 +12,7 @@ local data_ok, lspprogress = pcall(require, "lsp-progress")
if data_ok then
lsp_progress = lspprogress.progress
end
local codeium = component.codeium
M.filetype = {
"TelescopePrompt",
@ -46,7 +47,7 @@ M.rounded = function(colorscheme)
},
lualine_b = { get_branch },
lualine_c = { diff, lsp_info, lsp_progress },
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
lualine_x = { diagnostics, spaces, codeium, treesitter, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "" }, padding = 1 },
@ -81,7 +82,7 @@ M.roundedall = function(colorscheme)
},
lualine_b = { get_branch },
lualine_c = { diff, lsp_info, lsp_progress },
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
lualine_x = { diagnostics, spaces, codeium, treesitter, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "", left = "" }, padding = 1 },
@ -116,7 +117,7 @@ M.triangle = function(colorscheme)
},
lualine_b = { get_branch },
lualine_c = { diff, lsp_info, lsp_progress },
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
lualine_x = { diagnostics, spaces, codeium, treesitter, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = " ", left = "" }, padding = 1 },
@ -151,7 +152,7 @@ M.parallelogram = function(colorscheme)
},
lualine_b = { get_branch },
lualine_c = { diff, lsp_info, lsp_progress },
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
lualine_x = { diagnostics, spaces, codeium, treesitter, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "", left = "" }, padding = 1 },
@ -186,7 +187,7 @@ M.square = function(colorscheme)
},
lualine_b = { get_branch },
lualine_c = { diff, lsp_info, lsp_progress },
lualine_x = { diagnostics, spaces, treesitter, "filetype" },
lualine_x = { diagnostics, spaces, codeium, treesitter, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = " " }, padding = 1 },

View file

@ -3,7 +3,7 @@ local M = {}
-- for debug
local debug_key = {}
if vim.fn.has("win32") == 0 then
if vim.fn.has "win32" == 0 then
debug_key = {
name = "  Debug",
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
@ -26,47 +26,47 @@ end
function M._LAZYGIT_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
local lazygit = Terminal:new { cmd = "lazygit", hidden = true }
lazygit:toggle()
end
function M._NODE_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local node = Terminal:new({ cmd = "node", hidden = true })
local node = Terminal:new { cmd = "node", hidden = true }
node:toggle()
end
function M._BTOP_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local htop = Terminal:new({ cmd = "btop", hidden = true })
local htop = Terminal:new { cmd = "btop", hidden = true }
htop:toggle()
end
function M._PYTHON_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local python = Terminal:new({ cmd = "python", hidden = true })
local python = Terminal:new { cmd = "python", hidden = true }
python:toggle()
end
function M._NEWTAB_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local pwsh = Terminal:new({ cmd = "pwsh", hidden = true, direction = "tab" })
local pwsh = Terminal:new { cmd = "pwsh", hidden = true, direction = "tab" }
pwsh:toggle()
end
function M._OPEN_EXPLORER()
local Terminal = require("toggleterm.terminal").Terminal
local pwsh = Terminal:new({ cmd = "explorer .", hidden = true, direction = "tab" })
local pwsh = Terminal:new { cmd = "explorer .", hidden = true, direction = "tab" }
pwsh:toggle()
end
function M._LIVE_SERVER()
local Terminal = require("toggleterm.terminal").Terminal
local live_server = Terminal:new({
local live_server = Terminal:new {
cmd = "live-server",
hidden = true,
direction = "tab",
})
}
live_server:toggle()
end
@ -277,6 +277,8 @@ M.mappings = {
},
}
table.insert(M.mappings, { ["c"] = { ":call codeium#Chat()<cr>", "󰭹 Codeium Chat" } })
M.mappings2 = {
["/"] = { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", " 󰆈 Commet Block" },
}