diff --git a/flake.lock b/flake.lock index a17adc3..95c9989 100644 --- a/flake.lock +++ b/flake.lock @@ -4,6 +4,7 @@ "inputs": { "flake-utils": "flake-utils", "nixpkgs": [ + "nixvim", "nixvim", "nixpkgs" ] @@ -39,11 +40,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -55,11 +56,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -85,6 +86,38 @@ } }, "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_7": { "flake": false, "locked": { "lastModified": 1650374568, @@ -103,6 +136,7 @@ "flake-parts": { "inputs": { "nixpkgs-lib": [ + "nixvim", "nixvim", "nixpkgs" ] @@ -141,7 +175,25 @@ }, "flake-utils-plus": { "inputs": { - "flake-utils": "flake-utils_3" + "flake-utils": "flake-utils_4" + }, + "locked": { + "lastModified": 1696331477, + "narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "type": "github" + } + }, + "flake-utils-plus_2": { + "inputs": { + "flake-utils": "flake-utils_5" }, "locked": { "lastModified": 1657226504, @@ -157,9 +209,9 @@ "type": "github" } }, - "flake-utils-plus_2": { + "flake-utils-plus_3": { "inputs": { - "flake-utils": "flake-utils_4" + "flake-utils": "flake-utils_6" }, "locked": { "lastModified": 1696331477, @@ -179,6 +231,24 @@ "inputs": { "systems": "systems_2" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, "locked": { "lastModified": 1685518550, "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", @@ -193,7 +263,25 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_4": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { "locked": { "lastModified": 1644229661, "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", @@ -208,9 +296,9 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_6": { "inputs": { - "systems": "systems_3" + "systems": "systems_5" }, "locked": { "lastModified": 1694529238, @@ -227,6 +315,29 @@ } }, "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "nixvim", @@ -272,6 +383,7 @@ "home-manager_2": { "inputs": { "nixpkgs": [ + "nixvim", "nixvim", "nixpkgs" ] @@ -293,16 +405,17 @@ "nix-darwin": { "inputs": { "nixpkgs": [ + "nixvim", "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1711591334, - "narHash": "sha256-9d5ilxxq4CXw44eFw8VFrRneAKex7D8xjn95mwZjgf4=", + "lastModified": 1711763326, + "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "f0dd0838c3558b59dc3b726d8ab89f5b5e35c297", + "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", "type": "github" }, "original": { @@ -362,7 +475,47 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1704290814, + "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "nixvim": "nixvim_2", + "pre-commit-hooks": "pre-commit-hooks_2", + "snowfall-lib": "snowfall-lib", + "unstable": "unstable" + }, + "locked": { + "lastModified": 1711834191, + "narHash": "sha256-P0WKgVpH8+QpKUcrhvfMiEjYB2SCezkKgBuqU24R/aA=", + "owner": "Daholli", + "repo": "nixvim", + "rev": "b781ea53c3926c396ef13c41dedbc0e03aed41bb", + "type": "github" + }, + "original": { + "owner": "Daholli", + "repo": "nixvim", + "type": "github" + } + }, + "nixvim_2": { "inputs": { "devshell": "devshell", "flake-compat": "flake-compat", @@ -370,16 +523,17 @@ "home-manager": "home-manager_2", "nix-darwin": "nix-darwin", "nixpkgs": [ - "nixpkgs" + "nixvim", + "unstable" ], "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1711630555, - "narHash": "sha256-jslStwDlRwVZLwcFkExWegOGYv/Dn9q7yoocUX7AsIg=", + "lastModified": 1711809391, + "narHash": "sha256-/nGV6P8nB/R/ysbl1KQIKIwp1mQPXxtnoEd+pf3X+nw=", "owner": "nix-community", "repo": "nixvim", - "rev": "acb917fbf2bc9ce9c556516d8a1f257709b3cf1e", + "rev": "0c16f59202c5062d12ef9cd4560cc9fca9d99f9a", "type": "github" }, "original": { @@ -394,14 +548,41 @@ "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ + "nixvim", "nixvim", "nixpkgs" ], "nixpkgs-stable": [ + "nixvim", "nixvim", "nixpkgs" ] }, + "locked": { + "lastModified": 1711760932, + "narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "c11e43aed6f17336c25cd120eac886b96c455731", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, "locked": { "lastModified": 1703939133, "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", @@ -424,17 +605,17 @@ "nixpkgs": "nixpkgs", "nixvim": "nixvim", "snowfall-flake": "snowfall-flake", - "snowfall-lib": "snowfall-lib_2", - "unstable": "unstable" + "snowfall-lib": "snowfall-lib_3", + "unstable": "unstable_2" } }, "snowfall-flake": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_5", "nixpkgs": [ "unstable" ], - "snowfall-lib": "snowfall-lib" + "snowfall-lib": "snowfall-lib_2" }, "locked": { "lastModified": 1709228099, @@ -454,6 +635,29 @@ "inputs": { "flake-compat": "flake-compat_4", "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixvim", + "unstable" + ] + }, + "locked": { + "lastModified": 1696432959, + "narHash": "sha256-oJQZv2MYyJaVyVJY5IeevzqpGvMGKu5pZcCCJvb+xjc=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "92803a029b5314d4436a8d9311d8707b71d9f0b6", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" + } + }, + "snowfall-lib_2": { + "inputs": { + "flake-compat": "flake-compat_6", + "flake-utils-plus": "flake-utils-plus_2", "nixpkgs": [ "snowfall-flake", "nixpkgs" @@ -473,10 +677,10 @@ "type": "github" } }, - "snowfall-lib_2": { + "snowfall-lib_3": { "inputs": { - "flake-compat": "flake-compat_5", - "flake-utils-plus": "flake-utils-plus_2", + "flake-compat": "flake-compat_7", + "flake-utils-plus": "flake-utils-plus_3", "nixpkgs": [ "nixpkgs" ] @@ -540,7 +744,53 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "unstable": { + "locked": { + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "unstable_2": { "locked": { "lastModified": 1711333969, "narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=", diff --git a/flake.nix b/flake.nix index c769a9f..2743a78 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ # The nix way of configuring vim nixvim = { - url = "github:nix-community/nixvim"; + url = "github:Daholli/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -59,12 +59,12 @@ overlays = with inputs; [ snowfall-flake.overlays.default + nixvim.overlays.default ]; systems.modules.nixos = with inputs; [ home-manager.nixosModules.home-manager nix-ld.nixosModules.nix-ld - nixvim.nixosModules.nixvim ]; }; } diff --git a/modules/nixos/apps/cli-apps/nixvim/default.nix b/modules/nixos/apps/cli-apps/nixvim/default.nix index 4ca87a9..57b5893 100644 --- a/modules/nixos/apps/cli-apps/nixvim/default.nix +++ b/modules/nixos/apps/cli-apps/nixvim/default.nix @@ -14,302 +14,6 @@ in { }; config = mkIf cfg.enable { - programs.nixvim = { - enable = true; - colorschemes.tokyonight = enabled; - globals.mapleader = " "; - - clipboard.providers.wl-copy = enabled; - - options = { - number = true; - relativenumber = true; - shiftwidth = 4; - }; - - autoCmd = [ - { - event = "FileType"; - pattern = "nix"; - command = "setlocal tabstop=2 shiftwidth=2"; - } - ]; - - keymaps = [ - { - action = "Ex"; - key = "e"; - options.desc = "Open Explorer"; - } - { - mode = "n"; - action = "w"; - key = ""; - options.desc = "Save"; - } - { - mode = "n"; - action = "noh"; - key = ""; - options.silent = true; - } - { - mode = "n"; - action = "UndotreeToggle"; - key = "ut"; - options.desc = "Toggle Undotree"; - } - { - mode = "n"; - action = "UndotreeToggle"; - key = "uf"; - options.desc = "Focus Undotree"; - } - ]; - - plugins = { - telescope = { - enable = true; - keymaps = { - "sr" = { - action = "oldfiles"; - desc = "[s]earch [r]ecent"; - }; - - "sk" = { - action = "keymaps"; - desc = "[s]earch [k]eys"; - }; - - "sg" = { - action = "live_grep"; - desc = "[s]earch [g]rep"; - }; - }; - }; - - harpoon = { - enable = true; - enableTelescope = true; - keymaps = { - addFile = "a"; - toggleQuickMenu = "ha"; - navFile = { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - }; - }; - }; - - treesitter = { - enable = true; - nixGrammars = true; - indent = true; - }; - treesitter-context.enable = true; - - lualine.enable = true; - - copilot-lua = { - panel.enabled = false; - suggestion.enabled = false; - }; - - nix.enable = true; - nix-develop.enable = true; - - nvim-autopairs.enable = true; - - rainbow-delimiters = {enable = true;}; - nvim-colorizer.enable = true; - - undotree.enable = true; - - which-key = {enable = true;}; - - trouble.enable = true; - - markdown-preview.enable = true; - - dashboard = {enable = true;}; - - auto-save = { - enable = true; - enableAutoSave = true; - }; - - ## cmp extract into file - luasnip.enable = true; - cmp-buffer = {enable = true;}; - - cmp-emoji = {enable = true;}; - - cmp-nvim-lsp = {enable = true;}; - - cmp-path = {enable = true;}; - - cmp_luasnip = {enable = true;}; - - cmp = { - enable = true; - - settings = { - snippet.expand = "luasnip"; - sources = [ - {name = "nvim_lsp";} - {name = "luasnip";} - {name = "copilot";} - { - name = "buffer"; - option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; - } - {name = "nvim_lua";} - {name = "path";} - ]; - - formatting = { - fields = ["abbr" "kind" "menu"]; - format = - # lua - '' - function(_, item) - local icons = { - Namespace = "󰌗", - Text = "󰉿", - Method = "󰆧", - Function = "󰆧", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈚", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - TypeParameter = "󰊄", - Table = "", - Object = "󰅩", - Tag = "", - Array = "[]", - Boolean = "", - Number = "", - Null = "󰟢", - String = "󰉿", - Calendar = "", - Watch = "󰥔", - Package = "", - Copilot = "", - Codeium = "", - TabNine = "", - } - - local icon = icons[item.kind] or "" - item.kind = string.format("%s %s", icon, item.kind or "") - return item - end - ''; - }; - - window = { - completion = { - winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; - scrollbar = false; - sidePadding = 0; - border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"]; - }; - - settings.documentation = { - border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"]; - winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; - }; - }; - - mapping = { - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })"; - "" = - # lua - '' - function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") - else - fallback() - end - end - ''; - "" = - # lua - '' - function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") - else - fallback() - end - end - ''; - }; - }; - }; - - ## lsp - lsp = { - enable = true; - servers = { - fsautocomplete.enable = true; - nixd.enable = true; - }; - keymaps.lspBuf = { - "gd" = "definition"; - "gD" = "references"; - "gt" = "type_definition"; - "gi" = "implementation"; - "K" = "hover"; - }; - }; - rust-tools.enable = true; - - ## none-ls - none-ls = { - enable = true; - sources = { - diagnostics = {statix.enable = true;}; - formatting = { - nixfmt.enable = true; - markdownlint.enable = true; - shellharden.enable = true; - shfmt.enable = true; - }; - }; - }; - }; - }; + environment.systemPackages = with pkgs; [less wyrdgard.neovim]; }; } diff --git a/modules/nixos/apps/cli-apps/nixvim/default.nix.bak b/modules/nixos/apps/cli-apps/nixvim/default.nix.bak new file mode 100644 index 0000000..4ca87a9 --- /dev/null +++ b/modules/nixos/apps/cli-apps/nixvim/default.nix.bak @@ -0,0 +1,315 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.wyrdgard; let + cfg = config.wyrdgard.apps.cli-apps.nixvim; +in { + options.wyrdgard.apps.cli-apps.nixvim = with types; { + enable = mkBoolOpt true "Whether to enable nixvim or not (Default true)"; + }; + + config = mkIf cfg.enable { + programs.nixvim = { + enable = true; + colorschemes.tokyonight = enabled; + globals.mapleader = " "; + + clipboard.providers.wl-copy = enabled; + + options = { + number = true; + relativenumber = true; + shiftwidth = 4; + }; + + autoCmd = [ + { + event = "FileType"; + pattern = "nix"; + command = "setlocal tabstop=2 shiftwidth=2"; + } + ]; + + keymaps = [ + { + action = "Ex"; + key = "e"; + options.desc = "Open Explorer"; + } + { + mode = "n"; + action = "w"; + key = ""; + options.desc = "Save"; + } + { + mode = "n"; + action = "noh"; + key = ""; + options.silent = true; + } + { + mode = "n"; + action = "UndotreeToggle"; + key = "ut"; + options.desc = "Toggle Undotree"; + } + { + mode = "n"; + action = "UndotreeToggle"; + key = "uf"; + options.desc = "Focus Undotree"; + } + ]; + + plugins = { + telescope = { + enable = true; + keymaps = { + "sr" = { + action = "oldfiles"; + desc = "[s]earch [r]ecent"; + }; + + "sk" = { + action = "keymaps"; + desc = "[s]earch [k]eys"; + }; + + "sg" = { + action = "live_grep"; + desc = "[s]earch [g]rep"; + }; + }; + }; + + harpoon = { + enable = true; + enableTelescope = true; + keymaps = { + addFile = "a"; + toggleQuickMenu = "ha"; + navFile = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + }; + }; + }; + + treesitter = { + enable = true; + nixGrammars = true; + indent = true; + }; + treesitter-context.enable = true; + + lualine.enable = true; + + copilot-lua = { + panel.enabled = false; + suggestion.enabled = false; + }; + + nix.enable = true; + nix-develop.enable = true; + + nvim-autopairs.enable = true; + + rainbow-delimiters = {enable = true;}; + nvim-colorizer.enable = true; + + undotree.enable = true; + + which-key = {enable = true;}; + + trouble.enable = true; + + markdown-preview.enable = true; + + dashboard = {enable = true;}; + + auto-save = { + enable = true; + enableAutoSave = true; + }; + + ## cmp extract into file + luasnip.enable = true; + cmp-buffer = {enable = true;}; + + cmp-emoji = {enable = true;}; + + cmp-nvim-lsp = {enable = true;}; + + cmp-path = {enable = true;}; + + cmp_luasnip = {enable = true;}; + + cmp = { + enable = true; + + settings = { + snippet.expand = "luasnip"; + sources = [ + {name = "nvim_lsp";} + {name = "luasnip";} + {name = "copilot";} + { + name = "buffer"; + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + } + {name = "nvim_lua";} + {name = "path";} + ]; + + formatting = { + fields = ["abbr" "kind" "menu"]; + format = + # lua + '' + function(_, item) + local icons = { + Namespace = "󰌗", + Text = "󰉿", + Method = "󰆧", + Function = "󰆧", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈚", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", + Table = "", + Object = "󰅩", + Tag = "", + Array = "[]", + Boolean = "", + Number = "", + Null = "󰟢", + String = "󰉿", + Calendar = "", + Watch = "󰥔", + Package = "", + Copilot = "", + Codeium = "", + TabNine = "", + } + + local icon = icons[item.kind] or "" + item.kind = string.format("%s %s", icon, item.kind or "") + return item + end + ''; + }; + + window = { + completion = { + winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; + scrollbar = false; + sidePadding = 0; + border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"]; + }; + + settings.documentation = { + border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"]; + winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; + }; + }; + + mapping = { + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })"; + "" = + # lua + '' + function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end + ''; + "" = + # lua + '' + function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end + ''; + }; + }; + }; + + ## lsp + lsp = { + enable = true; + servers = { + fsautocomplete.enable = true; + nixd.enable = true; + }; + keymaps.lspBuf = { + "gd" = "definition"; + "gD" = "references"; + "gt" = "type_definition"; + "gi" = "implementation"; + "K" = "hover"; + }; + }; + rust-tools.enable = true; + + ## none-ls + none-ls = { + enable = true; + sources = { + diagnostics = {statix.enable = true;}; + formatting = { + nixfmt.enable = true; + markdownlint.enable = true; + shellharden.enable = true; + shfmt.enable = true; + }; + }; + }; + }; + }; + }; +}