diff --git a/neovim/blink-cmp.lua b/neovim/blink-cmp.lua new file mode 100644 index 0000000..5f28792 --- /dev/null +++ b/neovim/blink-cmp.lua @@ -0,0 +1,28 @@ +require("copilot").setup({ + copilot_model = "claude-4-sonnet" +}) + +require("blink-copilot").setup({}) + +require("blink-cmp").setup({ + completion = { + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + ghost_text = { enabled = true }, + }, + keymap = { + preset = "default" + }, + signature = { enabled = true }, + sources = { + default = { "copilot", "lsp", "buffer", "path", "cmdline", "codecompanion" }, + + providers = { + copilot = { + name = "copilot", + module = "blink-copilot", + score_offset = 100, + async = true, + } + } + }, +}) diff --git a/neovim/default.nix b/neovim/default.nix index 56f2207..d83f02d 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,5 +1,9 @@ -{ pkgs, theme, vimwikiPath, ... }: { + pkgs, + theme, + vimwikiPath, + ... +}: { programs = { neovim = { enable = true; @@ -55,15 +59,8 @@ luasnip # auto-completion - nvim-cmp - cmp-nvim-lsp - cmp-buffer - cmp-path - cmp-cmdline - cmp-nvim-lua - cmp_luasnip - cmp-calc - cmp-nvim-lsp-signature-help + blink-cmp + blink-copilot # telescope telescope-nvim @@ -82,7 +79,6 @@ # Copilot copilot-lua copilot-cmp - CopilotChat-nvim codecompanion-nvim # debugging @@ -114,14 +110,14 @@ texlab nixd nixpkgs-fmt - bitbake-language-server pyright - (python3.withPackages (ps: with ps; [ - pep8 - autopep8 - python-lsp-server - ])) + (python3.withPackages (ps: + with ps; [ + pep8 + autopep8 + python-lsp-server + ])) #clipboard xclip @@ -150,7 +146,7 @@ require("local_indent-blankline") require("local_gitsigns") require("local_luasnip") - require("local_nvim-cmp") + require("local_blink-cmp") require("local_telescope") require("local_themes").setup("${theme}") @@ -168,17 +164,6 @@ require("local_firenvim") - require("CopilotChat").setup({ - highlight_headers = false, - separator = "---", - error_header = "> [!ERROR] Error", - window = { - layout = "float", - width = 0.8, - height = 0.8, - }, - }) - require("local_codecompanion") require("diffview").setup({ @@ -212,7 +197,7 @@ home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua; home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua; home.file.".config/nvim/lua/local_luasnip.lua".source = ./luasnip.lua; - home.file.".config/nvim/lua/local_nvim-cmp.lua".source = ./nvim-cmp.lua; + home.file.".config/nvim/lua/local_blink-cmp.lua".source = ./blink-cmp.lua; home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua; home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua; diff --git a/neovim/lspconfig.lua b/neovim/lspconfig.lua index 7877011..0d739b9 100644 --- a/neovim/lspconfig.lua +++ b/neovim/lspconfig.lua @@ -50,8 +50,6 @@ lsp_status.register_progress() require('lazydev').setup() -local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities) - local servers = { ["bashls"] = {}, ["bitbake_language_server"] = {}, diff --git a/neovim/nvim-cmp.lua b/neovim/nvim-cmp.lua deleted file mode 100644 index 9b9aa93..0000000 --- a/neovim/nvim-cmp.lua +++ /dev/null @@ -1,96 +0,0 @@ -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and - vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub( - col, col):match("%s") == nil -end - -local cmp = require("cmp") -local luasnip = require("luasnip") -local copilot_lua = require("copilot") -local copilot_cmp = require("copilot_cmp") -local lspkind = require("lspkind") - -copilot_lua.setup({ - copilot_model = "claude-3.5-sonnet", -}) -copilot_cmp.setup({}) - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - sources = cmp.config.sources({ - { name = "copilot" }, - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "luasnip" }, - { name = "path" }, - { name = "buffer" }, - { name = "nvim-lua" }, - { name = "calc" }, - }), - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - experimental = { ghost_text = true }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - format = lspkind.cmp_format({ - mode = "symbol", - maxwidth = { - menu = 50, - abbr = 50, - }, - ellipsis_char = "...", - show_labelDetails = true, - symbol_map = { - Copilot = "", - } - }), - }, -}) - --- `/` cmdline setup. -cmp.setup.cmdline("/", { - sources = cmp.config.sources( - { name = "buffer" } - ) -}) - --- `:` cmdline setup. -cmp.setup.cmdline(":", { - sources = cmp.config.sources( - { name = "path" }, - { name = "cmdline" } - ) -})