{ pkgs, config, lib, ... }: let cfg = config.pim.neovim; in { options.pim.neovim.enable = lib.mkEnableOption "neovim"; config = lib.mkIf cfg.enable { # Disable Stylix styling of Neovim, # because we have a plugin for that. stylix.targets.neovim.enable = false; programs.neovim = { enable = true; viAlias = true; vimAlias = true; vimdiffAlias = true; defaultEditor = true; extraLuaConfig = builtins.readFile ./core.lua; extraPackages = with pkgs; [ nil pyright gopls terraform-ls nixfmt-classic stylua black nixpkgs-fmt ]; plugins = with pkgs.vimPlugins; [ { plugin = nvim-lspconfig; type = "lua"; config = builtins.readFile ./lspconfig.lua; } gruvbox-nvim { plugin = leap-nvim; type = "lua"; config = builtins.readFile ./leap.lua; } { plugin = telescope-nvim; type = "lua"; config = builtins.readFile ./telescope.lua; } { plugin = vim-commentary; type = "lua"; config = builtins.readFile ./commentary.lua; } vim-sleuth { plugin = gitsigns-nvim; type = "lua"; config = ''require("gitsigns").setup()''; } { plugin = nvim-cmp; type = "lua"; config = builtins.readFile ./cmp.lua; } cmp-nvim-lsp friendly-snippets neodev-nvim luasnip cmp_luasnip { plugin = nvim-treesitter.withAllGrammars; type = "lua"; config = builtins.readFile ./treesitter.lua; } { plugin = bufferline-nvim; type = "lua"; config = builtins.readFile ./bufferline.lua; } nvim-web-devicons lsp-format-nvim { plugin = pkgs.vimPlugins.none-ls-nvim; type = "lua"; config = builtins.readFile ./none-ls.lua; } ]; }; programs.git.extraConfig.core.editor = "nvim"; }; }