From f4ea180cca36d8044694e90cc5d2f6871cda010f Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 17 Nov 2024 11:40:23 +0100 Subject: [PATCH] Neovim: Replace blink.cmp flake with nixpkgs + update its config --- home/modules/neovim/default.nix | 93 ++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix index bf8e8c9d..106ad74c 100644 --- a/home/modules/neovim/default.nix +++ b/home/modules/neovim/default.nix @@ -122,24 +122,24 @@ in { }; highlight = { - # Manually define blink.cmp highlight groups until catpuccin supports it. - BlinkCmpMenu = { - bg = "#${color.hex.dark.base}"; - }; - BlinkCmpMenuBorder = { - bg = "#${color.hex.dark.base}"; - fg = "#${color.hex.dark.blue}"; - }; - BlinkCmpMenuSelection = { - bg = "#${color.hex.dark.blue}"; - fg = "#${color.hex.dark.crust}"; - bold = true; - }; - BlinkCmpLabel = { - bg = "#${color.hex.dark.base}"; - fg = "#${color.hex.dark.text}"; - bold = false; - }; + # Manually define blink.cmp highlight groups until catpuccin supports it. Update: Catpuccin supports it now. + # BlinkCmpMenu = { + # bg = "#${color.hex.dark.base}"; + # }; + # BlinkCmpMenuBorder = { + # bg = "#${color.hex.dark.base}"; + # fg = "#${color.hex.dark.blue}"; + # }; + # BlinkCmpMenuSelection = { + # bg = "#${color.hex.dark.blue}"; + # fg = "#${color.hex.dark.crust}"; + # bold = true; + # }; + # BlinkCmpLabel = { + # bg = "#${color.hex.dark.base}"; + # fg = "#${color.hex.dark.text}"; + # bold = false; + # }; }; # extraLuaPackages = with pkgs.lua51Packages; []; @@ -311,6 +311,7 @@ in { # https://github.com/catppuccin/nvim/tree/main?tab=readme-ov-file#integrations default_integrations = true; integrations = { + blink_cmp = true; dashboard = true; diffview = true; flash = true; @@ -377,27 +378,15 @@ in { }; }; - # TODO: Does not work with luasnips yet :( - # TODO: Check if plugin landed in repos blink-cmp = rec { name = "blink.cmp"; - pkg = inputs.blink-cmp.packages.${system}.default; + # pkg = inputs.blink-cmp.packages.${system}.default; + pkg = pkgs.vimPlugins.blink-cmp; lazy = true; event = ["InsertEnter"]; config = mkDefaultConfig name; - opts = { - sources = { - providers.__raw = '' - { - { 'blink.cmp.sources.lsp', name = 'LSP' }, - { 'blink.cmp.sources.path', name = 'Path', score_offset = 3 }, - { 'blink.cmp.sources.snippets', name = 'Snippets', score_offset = -3 }, - -- Disable the buffer completion because I don't like it - -- { 'blink.cmp.sources.buffer', name = 'Buffer', fallback_for = { 'LSP' } }, - } - ''; - }; + opts = { keymap = { show = ""; hide = ""; @@ -413,7 +402,32 @@ in { snippet_forward = ""; snippet_backward = ""; }; - nerd_font_variant = "mono"; + + accept = { + expand_snippet = "require('luasnip').lsp_expand"; + auto_brackets = { + enabled = true; + }; + }; + + trigger = { + signature_help = { + enabled = true; + }; + }; + + fuzzy = { + use_typo_resistance = true; + use_frequency = true; + use_proximity = true; + }; + + sources = { + completion = { + enabled_providers = ["lsp" "path" "snippets"]; # No "buffer" + }; + }; + windows = { autocomplete = { border = "rounded"; @@ -427,17 +441,12 @@ in { signature_help = { border = "rounded"; }; - }; - accept = { - auto_brackets = { - enabled = true; - }; - }; - trigger = { - signature_help = { + ghost_text = { enabled = true; }; }; + + nerd_font_variant = "mono"; }; };