From b4550106246663506d8be8e78f668555252dc004 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 11 Dec 2024 20:15:15 +0100 Subject: [PATCH] nvim: blink-cmp goodness --- flake.lock | 141 +++++++++++++++++++++----------- home/common/nvim/blink-cmp.lua | 56 +++++++++++++ home/common/nvim/default.nix | 44 +--------- home/common/nvim/treesitter.nix | 2 +- 4 files changed, 151 insertions(+), 92 deletions(-) create mode 100644 home/common/nvim/blink-cmp.lua diff --git a/flake.lock b/flake.lock index c6fc0c8..086a183 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,22 @@ { "nodes": { "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1733328505, @@ -16,7 +32,7 @@ "type": "github" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1696426674, @@ -94,26 +110,23 @@ }, "ghostty": { "inputs": { - "nixpkgs-stable": [ - "nixpkgs" - ], - "nixpkgs-unstable": [ - "nixpkgs" - ], + "flake-compat": "flake-compat", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", "zig": "zig" }, "locked": { - "lastModified": 1734275633, - "narHash": "sha256-/5Rnuouf4DrQWKc5sMjA/8Uiznp8/oCQe3YaYvp+fWU=", - "ref": "refs/heads/main", - "rev": "ceef2900e24944b18a6aadf5e6dd40aeef64e85d", - "revCount": 8271, - "type": "git", - "url": "ssh://git@github.com/ghostty-org/ghostty" + "lastModified": 1735271978, + "narHash": "sha256-y6Ony5eq4F4E76Y2ZhALSEzBZ4GbGRVQIEScPieCDGI=", + "owner": "ghostty-org", + "repo": "ghostty", + "rev": "a8e5eef11cc67f87f445626f9ca2993373774bf8", + "type": "github" }, "original": { - "type": "git", - "url": "ssh://git@github.com/ghostty-org/ghostty" + "owner": "ghostty-org", + "repo": "ghostty", + "type": "github" } }, "ghostty-hm": { @@ -133,7 +146,7 @@ }, "git-hooks": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "gitignore": "gitignore", "nixpkgs": [ "neovim-nightly-overlay", @@ -145,11 +158,11 @@ ] }, "locked": { - "lastModified": 1733665616, - "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", + "lastModified": 1734797603, + "narHash": "sha256-ulZN7ps8nBV31SE+dwkDvKIzvN6hroRY8sYOT0w+E28=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", + "rev": "f0f0dc4920a903c3e08f5bdb9246bb572fcae498", "type": "github" }, "original": { @@ -209,11 +222,11 @@ ] }, "locked": { - "lastModified": 1734093295, - "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", + "lastModified": 1735053786, + "narHash": "sha256-Gm+0DcbUS338vvkwyYWms5jsWlx8z8MeQBzcnIDuIkw=", "owner": "nix-community", "repo": "home-manager", - "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", + "rev": "35b98d20ca8f4ca1f6a2c30b8a2c8bb305a36d84", "type": "github" }, "original": { @@ -224,7 +237,7 @@ }, "neovim-nightly-overlay": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", "git-hooks": "git-hooks", "hercules-ci-effects": "hercules-ci-effects", @@ -233,11 +246,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1734048484, - "narHash": "sha256-EtSEYNx19xzuEBJsT7yXG+nVx11CM3rvrAQAXcvG/5Q=", + "lastModified": 1735172062, + "narHash": "sha256-Ru+5fwMqXEoc6G1PbuTppAzxtqvj0322cBAWCb0Yhbo=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "044f9a36ad620a119ebe154c26ec571a09f75039", + "rev": "d05e1d754812bcd89925d845992f377faf6c4944", "type": "github" }, "original": { @@ -249,11 +262,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1734000357, - "narHash": "sha256-8FO5Ca9bLEiD649b5gkQCdjpTmbPenJHpN0JBhtLpjE=", + "lastModified": 1735157560, + "narHash": "sha256-ndlWdGm61W3uObi8cowWqnPdJwq2FsH4GHGOQYeNSOM=", "owner": "neovim", "repo": "neovim", - "rev": "17383870dd3b7f04eddd48ed929cc25c7e102277", + "rev": "487c48ec8689b865bad04fdb87b61f5ada25da97", "type": "github" }, "original": { @@ -264,11 +277,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1733749988, - "narHash": "sha256-+5qdtgXceqhK5ZR1YbP1fAUsweBIrhL38726oIEAtDs=", + "lastModified": 1734988233, + "narHash": "sha256-Ucfnxq1rF/GjNP3kTL+uTfgdoE9a3fxDftSfeLIS8mA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bc27f0fde01ce4e1bfec1ab122d72b7380278e68", + "rev": "de1864217bfa9b5845f465e771e0ecb48b30e02d", "type": "github" }, "original": { @@ -280,27 +293,59 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1734017764, - "narHash": "sha256-msOfmyJSjAHgIygI/JD0Ae3JsDv4rT54Nlfr5t6MQMQ=", + "lastModified": 1733423277, + "narHash": "sha256-TxabjxEgkNbCGFRHgM/b9yZWlBj60gUOUnRT/wbVQR8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "64e9404f308e0f0a0d8cdd7c358f74e34802494b", + "rev": "e36963a147267afc055f7cf65225958633e536bf", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.05", + "ref": "release-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1735141468, + "narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1734126203, - "narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=", + "lastModified": 1733229606, + "narHash": "sha256-FLYY5M0rpa5C2QAE3CKLYAM6TwbKicdRK6qNrSHlNrE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "71a6392e367b08525ee710a93af2e80083b5b3e2", + "rev": "566e53c2ad750c84f6d31f9ccb9d00f823165550", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable_2": { + "locked": { + "lastModified": 1735268880, + "narHash": "sha256-7QEFnKkzD13SPxs+UFR5bUFN2fRw+GlL0am72ZjNre4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7cc0bff31a3a705d3ac4fdceb030a17239412210", "type": "github" }, "original": { @@ -312,11 +357,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1734119587, - "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "lastModified": 1735291276, + "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", "type": "github" }, "original": { @@ -333,8 +378,8 @@ "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_2", - "nixpkgs-stable": "nixpkgs-stable", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-stable": "nixpkgs-stable_2", + "nixpkgs-unstable": "nixpkgs-unstable_2" } }, "systems": { @@ -360,11 +405,11 @@ ] }, "locked": { - "lastModified": 1733761991, - "narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=", + "lastModified": 1735135567, + "narHash": "sha256-8T3K5amndEavxnludPyfj3Z1IkcFdRpR23q+T0BVeZE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085", + "rev": "9e09d30a644c57257715902efbb3adc56c79cf28", "type": "github" }, "original": { diff --git a/home/common/nvim/blink-cmp.lua b/home/common/nvim/blink-cmp.lua new file mode 100644 index 0000000..b34b6fc --- /dev/null +++ b/home/common/nvim/blink-cmp.lua @@ -0,0 +1,56 @@ +require 'blink-cmp'.setup({ + keymap = { + preset = 'enter', + [""] = { "scroll_documentation_down" }, + [""] = { "scroll_documentation_up" }, + }, + completion = { + accept = { + auto_brackets = { enabled = true, }, + }, + + documentation = { + auto_show = true, + auto_show_delay_ms = 800, + window = { border = 'rounded', }, + }, + + ghost_text = { enabled = true }, + + list = { + selection = "manual", + }, + + menu = { + auto_show = true, + }, + }, + + fuzzy = { + prebuilt_binaries = { + download = false + }, + }, + + keymap = { + preset = 'super-tab', + }, + + signature = { + enabled = true, + window = { border = 'rounded', }, + }, + + sources = { + default = { 'lsp', 'codeium', 'buffer' }, + cmdline = {}, + providers = { + codeium = { + name = "codeium", + module = 'blink.compat.source', + score_offset = -100, + }, + }, + }, + +}) diff --git a/home/common/nvim/default.nix b/home/common/nvim/default.nix index 1c9b4a7..d6dd694 100644 --- a/home/common/nvim/default.nix +++ b/home/common/nvim/default.nix @@ -63,49 +63,7 @@ { plugin = blink-cmp; type = "lua"; - config = '' - require'blink-cmp'.setup({ - keymap = { - preset = 'enter', - [""] = { "scroll_documentation_down" }, - [""] = { "scroll_documentation_up" }, - }, - completion = { - accept = { - auto_brackets = { enabled = true, }, - }, - - documentation = { - auto_show = true, - auto_show_delay_ms = 800, - window = { border = 'rounded', }, - }, - - ghost_text = { enabled = true }, - - menu = { - auto_show = false, - }, - }, - - fuzzy = { - prebuilt_binaries = { - download = false - }, - }, - - signature = { - enabled = true, - window = { border = 'rounded', }, - }, - - sources = { - default = { 'lsp', 'buffer', 'path', 'snippets' }, - cmdline = {}, - }, - - }) - ''; + config = lib.fileContents ./blink-cmp.lua; } { diff --git a/home/common/nvim/treesitter.nix b/home/common/nvim/treesitter.nix index 9c765c4..25e15f8 100644 --- a/home/common/nvim/treesitter.nix +++ b/home/common/nvim/treesitter.nix @@ -11,9 +11,9 @@ ]; plugins = with pkgs.vimPlugins; [ - ts-comments-nvim nvim-ts-context-commentstring playground + ts-comments-nvim { plugin = nvim-treesitter-context;