feat(nvim): add codeium completion

This commit is contained in:
Moritz Böhme 2023-09-06 17:45:31 +02:00
parent dfa93f98df
commit 7f336c2a90
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
5 changed files with 84 additions and 27 deletions

View file

@ -71,6 +71,27 @@
"type": "github"
}
},
"codeium-nvim": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1693966170,
"narHash": "sha256-maRkkUCzjSXK04ts+Io0WFBV1MxR7dCw8I6TV03Dpbs=",
"owner": "jcdickinson",
"repo": "codeium.nvim",
"rev": "6a8cbce54c41e0c305b5f77721f61b2ddd4b6c6d",
"type": "github"
},
"original": {
"owner": "jcdickinson",
"repo": "codeium.nvim",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
@ -203,6 +224,21 @@
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
@ -220,7 +256,7 @@
"type": "github"
}
},
"flake-utils_2": {
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
@ -238,7 +274,7 @@
"type": "github"
}
},
"flake-utils_3": {
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
@ -530,7 +566,7 @@
},
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
@ -819,7 +855,7 @@
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_4",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_7",
"nixpkgs-stable": "nixpkgs-stable"
@ -861,7 +897,8 @@
"agenix": "agenix",
"arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"flake-utils": "flake-utils",
"codeium-nvim": "codeium-nvim",
"flake-utils": "flake-utils_2",
"hmts-nvim": "hmts-nvim",
"home-manager": "home-manager_2",
"hypr-contrib": "hypr-contrib",

View file

@ -53,6 +53,9 @@
actions-preview-nvim.flake = false;
actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim";
codeium-nvim.url = "github:jcdickinson/codeium.nvim";
codeium-nvim.inputs.nixpkgs.follows = "nixpkgs";
# Hyprland
hypr-contrib.url = "github:hyprwm/contrib";
hyprland.url = "github:hyprwm/Hyprland";

View file

@ -80,19 +80,18 @@ with builtins;
event = [ "InsertEnter" ];
dependencies = [
{ plugin = cmp-async-path; }
{ plugin = cmp-buffer; }
{ plugin = cmp-cmdline; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{
plugin = copilot-cmp;
dependencies = [
{
plugin = copilot-lua;
conf = readFile ./copilot-lua.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
];
plugin = codeium-nvim;
conf = /* lua */ ''
require("codeium").setup({})
'';
}
{ plugin = friendly-snippets; }
{ plugin = lspkind-nvim; }
{ plugin = luasnip; }
];
}

View file

@ -1,14 +1,6 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("copilot_cmp").setup()
local default_sources = {
{ name = "async_path", priority = 1 },
{ name = "copilot", priority = 2 },
{ name = "luasnip", priority = 2 },
{ name = "nvim_lsp", priority = 3 },
}
cmp.setup({
formatting = {
@ -17,7 +9,7 @@ cmp.setup({
maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = {
Copilot = "",
Codeium = "",
},
}),
},
@ -52,12 +44,36 @@ cmp.setup({
end
end, { "i", "s" }),
}),
sources = default_sources,
sources = {
{ name = "async_path", priority = 1 },
{ name = "buffer", priority = 1 },
{ name = "luasnip", priority = 2 },
{ name = "codeium", priority = 3 },
{ name = "nvim_lsp", priority = 4 },
},
})
cmp.setup.filetype("org", {
sources = vim.tbl_deep_extend("force", default_sources, {
{ name = "buffer", priority = 1 },
{ name = "orgmode", priority = 3 },
-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "buffer" },
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "async_path" },
}, {
{ name = "cmdline" },
}),
})

View file

@ -4,6 +4,8 @@ _: prev:
with lib.my;
{
vimPlugins = prev.vimPlugins // {
inherit (inputs.codeium-nvim.packages.${prev.system}.vimPlugins) codeium-nvim;
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;