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" "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": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -203,6 +224,21 @@
} }
}, },
"flake-utils": { "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": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
@ -220,7 +256,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": { "flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_3"
}, },
@ -238,7 +274,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_4"
}, },
@ -530,7 +566,7 @@
}, },
"neovim-flake": { "neovim-flake": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_3",
"nixpkgs": [ "nixpkgs": [
"neovim-nightly-overlay", "neovim-nightly-overlay",
"nixpkgs" "nixpkgs"
@ -819,7 +855,7 @@
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs_7", "nixpkgs": "nixpkgs_7",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
@ -861,7 +897,8 @@
"agenix": "agenix", "agenix": "agenix",
"arkenfox-userjs": "arkenfox-userjs", "arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "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", "hmts-nvim": "hmts-nvim",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hypr-contrib": "hypr-contrib", "hypr-contrib": "hypr-contrib",

View file

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

View file

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

View file

@ -1,14 +1,6 @@
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load() 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({ cmp.setup({
formatting = { formatting = {
@ -17,7 +9,7 @@ cmp.setup({
maxwidth = 50, -- prevent the popup from showing more than provided characters 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 ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = { symbol_map = {
Copilot = "", Codeium = "",
}, },
}), }),
}, },
@ -52,12 +44,36 @@ cmp.setup({
end end
end, { "i", "s" }), 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", { -- Set configuration for specific filetype.
sources = vim.tbl_deep_extend("force", default_sources, { cmp.setup.filetype("gitcommit", {
{ name = "buffer", priority = 1 }, sources = cmp.config.sources({
{ name = "orgmode", priority = 3 }, { 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; with lib.my;
{ {
vimPlugins = prev.vimPlugins // { vimPlugins = prev.vimPlugins // {
inherit (inputs.codeium-nvim.packages.${prev.system}.vimPlugins) codeium-nvim;
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix { smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim"; pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim; version = mkVersionInput inputs.smartcolumn-nvim;