diff --git a/config/plugins/cmp/cmp.nix b/config/plugins/cmp/cmp.nix index fa49b0c..6db0159 100644 --- a/config/plugins/cmp/cmp.nix +++ b/config/plugins/cmp/cmp.nix @@ -6,6 +6,9 @@ # Options provided to the require('cmp').setup function. settings = { + # Disable autocompletion by default + completion.autocomplete = false; + # The sources to use sources = [ # Language Server Protocol @@ -29,6 +32,31 @@ # Key mappings for the completion menu. mapping = { + # Confirm candidate on TAB immediately when there's only one completion entry + "" = /* lua */ '' + cmp.mapping(function(fallback) + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + + -- When the selection menu is open select the next item + if cmp.visible() then + cmp.select_next_item({behavior = cmp.SelectBehavior.Select}) + -- Ensure we are mid word + elseif col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil then + -- Open the selection menu + cmp.complete() + -- Autocomplete when there is only 1 selection available + if #cmp.get_entries() == 1 then + cmp.confirm({ select = true }) + end + -- Select the firt item + cmp.select_next_item({behavior = cmp.SelectBehavior.Select}) + -- Keep regular functionality of tab + else + fallback() + end + end, {'i', 's'}) + ''; + # Confirm selection "" = /* lua */ '' cmp.mapping.confirm({ select = true }) diff --git a/config/plugins/ui/nvim-tree.nix b/config/plugins/ui/nvim-tree.nix index 4563183..d290274 100644 --- a/config/plugins/ui/nvim-tree.nix +++ b/config/plugins/ui/nvim-tree.nix @@ -3,7 +3,7 @@ enable = true; # Configure nvim-tree - settings = { + extraOptions = { # Set width of nvim-tree view = { width = 38; diff --git a/flake.lock b/flake.lock index bc98440..6468d2f 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1756770412, - "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "4524271976b625a4a605beefd893f270620fd751", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -26,11 +26,11 @@ ] }, "locked": { - "lastModified": 1756770412, - "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "4524271976b625a4a605beefd893f270620fd751", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -71,27 +71,27 @@ ] }, "locked": { - "lastModified": 1754860581, - "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", "owner": "NuschtOS", "repo": "ixx", - "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.1.1", + "ref": "v0.0.6", "repo": "ixx", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1758690382, - "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", + "lastModified": 1744098102, + "narHash": "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e643668fd71b949c53f8626614b21ff71a07379d", + "rev": "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7", "type": "github" }, "original": { @@ -103,11 +103,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1754788789, - "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", "type": "github" }, "original": { @@ -118,11 +118,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1758763312, - "narHash": "sha256-puBMviZhYlqOdUUgEmMVJpXqC/ToEqSvkyZ30qQ09xM=", + "lastModified": 1744157173, + "narHash": "sha256-bWSjxDwq7iVePrhmA7tY2dyMWHuNJo8knkO4y+q4ZkY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e57b3b16ad8758fd681511a078f35c416a8cc939", + "rev": "6a39c6e495eefabc935d8ddf66aa45d85b85fa3f", "type": "github" }, "original": { @@ -136,15 +136,14 @@ "inputs": { "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_2", - "nuschtosSearch": "nuschtosSearch", - "systems": "systems_2" + "nuschtosSearch": "nuschtosSearch" }, "locked": { - "lastModified": 1758931855, - "narHash": "sha256-jTmbWlOxsy9dDP3UdCB6jEO63FtkM3dQG2FOq0b4foI=", + "lastModified": 1744272522, + "narHash": "sha256-cFuxYOLp/6L0eu5wX7xmaF4VhqEm/aT08awzEHGMMQE=", "owner": "nix-community", "repo": "nixvim", - "rev": "e0f1e4ae4bb8762b7c51c3a514ca19664fad9c3b", + "rev": "33c3f98fdc9a62183ec7d535bf910e04f141284b", "type": "github" }, "original": { @@ -163,11 +162,11 @@ ] }, "locked": { - "lastModified": 1758662783, - "narHash": "sha256-igrxT+/MnmcftPOHEb+XDwAMq3Xg1Xy7kVYQaHhPlAg=", + "lastModified": 1743683223, + "narHash": "sha256-LdXtHFvhEC3S64dphap1pkkzwjErbW65eH1VRerCUT0=", "owner": "NuschtOS", "repo": "search", - "rev": "7d4c0fc4ffe3bd64e5630417162e9e04e64b27a4", + "rev": "56a49ffef2908dad1e9a8adef1f18802bc760962", "type": "github" }, "original": { @@ -197,21 +196,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root",