From aeb6afa8809755f4299b44a0357dcf50e07fbb26 Mon Sep 17 00:00:00 2001 From: Anthony Cicchetti Date: Fri, 28 Mar 2025 15:45:52 -0400 Subject: [PATCH] blink-cmp - Way nicer --- flake.nix | 1 - nix/home-manager/flake.lock | 36 ++++---- nix/home-manager/modules/packages/neovim.nix | 86 +++++++++++-------- .../modules/packages/neovim/core.lua | 43 ---------- 4 files changed, 67 insertions(+), 99 deletions(-) diff --git a/flake.nix b/flake.nix index 5910e50..df5e716 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,6 @@ pkgs.hello pkgs.delta pkgs.difftastic - pkgs.alejandra pkgs.nodePackages.bash-language-server pkgs.shellcheck pkgs.shfmt diff --git a/nix/home-manager/flake.lock b/nix/home-manager/flake.lock index af949b5..fd83c16 100644 --- a/nix/home-manager/flake.lock +++ b/nix/home-manager/flake.lock @@ -140,11 +140,11 @@ "zon2nix": "zon2nix" }, "locked": { - "lastModified": 1742702839, - "narHash": "sha256-9atn1IrQH/R2ahK+Zj6JpS0CfjSPBLObHQeTw/4Vv5Q=", + "lastModified": 1743087033, + "narHash": "sha256-SvCTbeFnojkQ9Y6SjSTru2xaeqF4BvcteCcggfb5LGk=", "owner": "ghostty-org", "repo": "ghostty", - "rev": "c58fe676ad6212114455ac89a2703dcc3b8b67b7", + "rev": "0afb922375b2f8329f1c923cb58df75ddd4a6eb1", "type": "github" }, "original": { @@ -160,11 +160,11 @@ ] }, "locked": { - "lastModified": 1742771635, - "narHash": "sha256-HQHzQPrg+g22tb3/K/4tgJjPzM+/5jbaujCZd8s2Mls=", + "lastModified": 1743136572, + "narHash": "sha256-uwaVrKgi6g1TUq56247j6QvvFtYHloCkjCrEpGBvV54=", "owner": "nix-community", "repo": "home-manager", - "rev": "ad0614a1ec9cce3b13169e20ceb7e55dfaf2a818", + "rev": "1efd2503172016a6742c87b47b43ca2c8145607d", "type": "github" }, "original": { @@ -233,11 +233,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1742750727, - "narHash": "sha256-NCLL5+P8X0fLIEowCqDXU0OqLm5NRyNLyorghiPCfe4=", + "lastModified": 1743096623, + "narHash": "sha256-In+XxSBeofO1N3npGmdYFjrNFdzN2yQsJg26VdWsKcg=", "owner": "m15a", "repo": "flake-awesome-neovim-plugins", - "rev": "2454117d654292eee6d2a27f596d479833b9981e", + "rev": "7dafc523d8062ee7b9571d481f6651718e9a5807", "type": "github" }, "original": { @@ -248,11 +248,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742776792, - "narHash": "sha256-04dzabgZAMUt3jKwlCZpU877kCI3Kl1gWlNRlXo9KNo=", + "lastModified": 1743166830, + "narHash": "sha256-Vg0bN62JwzH1rPOpJRBUkmTUj6q/HW8l4sBS1AV/MMw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a6d0c7c8a8a79ec30c69c5dcd34a5225b55ce8bf", + "rev": "71d127da24364704116ca250f40fa478effa68e1", "type": "github" }, "original": { @@ -286,11 +286,11 @@ "nuschtosSearch": "nuschtosSearch" }, "locked": { - "lastModified": 1742732006, - "narHash": "sha256-ZIBMfPNb/hfoFf79MRnhDXGKl0yGhjlYEpy3+/jbxFI=", + "lastModified": 1743157969, + "narHash": "sha256-ldlSyVKNaXL7ys7Jr7mLhlpGDE4VPVcWmV7Odupn5TY=", "owner": "nix-community", "repo": "nixvim", - "rev": "7776e37b67e7875c3cd56d9d20fd050798071706", + "rev": "95573411bc9be155a93b0f15d2bad62c6b43b3cc", "type": "github" }, "original": { @@ -404,11 +404,11 @@ ] }, "locked": { - "lastModified": 1742370146, - "narHash": "sha256-XRE8hL4vKIQyVMDXykFh4ceo3KSpuJF3ts8GKwh5bIU=", + "lastModified": 1743081648, + "narHash": "sha256-WRAylyYptt6OX5eCEBWyTwOEqEtD6zt33rlUkr6u3cE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "adc195eef5da3606891cedf80c0d9ce2d3190808", + "rev": "29a3d7b768c70addce17af0869f6e2bd8f5be4b7", "type": "github" }, "original": { diff --git a/nix/home-manager/modules/packages/neovim.nix b/nix/home-manager/modules/packages/neovim.nix index df133f7..48e20b5 100644 --- a/nix/home-manager/modules/packages/neovim.nix +++ b/nix/home-manager/modules/packages/neovim.nix @@ -10,6 +10,9 @@ colorschemes = { onedark.enable = true; }; + diagnostics = { + virtual_lines = true; + }; plugins = { fugitive = { enable = true; @@ -67,9 +70,6 @@ }; }; }; - lsp-lines = { - enable = true; - }; lsp = { enable = true; preConfig = ''''; @@ -101,7 +101,7 @@ lspkind = { enable = true; mode = "symbol"; - cmp.enable = true; + # cmp.enable = true; symbolMap = { # TODO "Text" = ""; @@ -146,43 +146,55 @@ }; }; }; - cmp = { + blink-cmp = { enable = true; - autoEnableSources = true; settings = { - mapping = { - "" = "cmp.mapping.confirm({ select = true})"; - "" = "cmp.mapping.complete()"; - "" = '' - cmp.mapping(function(fallback) - if cmp.visible() then - local entry = cmp.get_selected_entry() - if not entry then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - end - cmp.confirm() - else - fallback() - end - end, {"i", "s", "c"}) - ''; - "" = '' - 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", "c"}) - ''; + keymap.preset = "super-tab"; + appearance = { + nerd_font_variant = "mono"; }; - view = { - entries.name = "custom"; + completion = { + ghost_text.enabled = true; + accept = { + auto_brackets = { + enabled = true; + }; + }; + list = { + selection = { + auto_insert = false; + preselect = true; + }; + }; + menu = { + # draw == colorful-menu.nvim config + }; + }; + signature = { + enabled = true; + }; + sources = { + default = [ + "lsp" + "path" + "snippets" + "buffer" + # [TODO] Disabled until I figure this out, rust uses :: "emoji" + ]; + providers = { + emoji = { + module = "blink-emoji"; + name = "Emoji"; + score_offset = 15; + opts = { + insert = true; + }; + }; + }; }; }; }; + blink-emoji.enable = true; project-nvim = { enable = true; enableTelescope = true; @@ -193,10 +205,10 @@ }; telescope = { enable = true; + extensions.live-grep-args.enable = true; enabledExtensions = [ "zf-native" # TODO "projects" # TODO - "egrepify" # TODO ]; # extraLua = { # post = builtins.readFile ./neovim/telescope.lua; @@ -209,7 +221,7 @@ }; "fg" = { mode = "n"; - action = "egrepify"; + action = "live_grep"; options.desc = "Live Grep"; }; "fb" = { diff --git a/nix/home-manager/modules/packages/neovim/core.lua b/nix/home-manager/modules/packages/neovim/core.lua index db96da9..9c3f8d4 100644 --- a/nix/home-manager/modules/packages/neovim/core.lua +++ b/nix/home-manager/modules/packages/neovim/core.lua @@ -47,46 +47,3 @@ require("gitlinker").setup() require("nvim-biscuits").setup() require("overseer").setup() require("officer").setup({ create_mappings = true }) - -local cmp = require("cmp") - -cmp.setup({ - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - cmdline, -}) - -cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - matching = { disallow_symbol_nonprefix_matching = false }, -}) - -do - function setup() - require("ufo").setup({ - provider_selector = function(bufnr, filetype, buftype) - return { "treesitter", "indent" } - end, - }) - - require("ufo").setup({}) - vim.o.foldcolumn = "1" -- '0' is not bad - vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - end - - success, output = pcall(setup) -- execute 'setup()' and catch any errors - if not success then - print("Error on setup for plugin: ufo") - print(output) - end -end