{ config , lib , pkgs , inputs , ... }: with lib; let cfg = config.my.programs.nvim; mkPlugin = name: { plugin = pkgs.vimPlugins.${name}; type = "lua"; config = lib.readFile (./plugins + "/${name}.lua"); }; in { options.my.programs.nvim.enable = mkEnableOption "nvim"; config = mkIf cfg.enable { home-manager.users.moritz = { home.packages = with pkgs; [ ( if config.my.programs.hyprland.enable then neovide-hyprland else neovide ) ]; programs.neovim = { enable = true; package = pkgs.neovim-nightly; vimAlias = true; vimdiffAlias = true; withNodeJs = true; withPython3 = true; extraLuaConfig = builtins.readFile ./init.lua; extraPackages = with pkgs; [ alejandra black isort jq nil nixpkgs-fmt rustfmt shfmt stylua sumneko-lua-language-server taplo yamlfmt ]; plugins = builtins.map mkPlugin [ "catppuccin-nvim" "comment-nvim" "copilot-lua" "dashboard-nvim" "formatter-nvim" "gitsigns-nvim" "lualine-nvim" "noice-nvim" "nvim-autopairs" "nvim-lastplace" "nvim-surround" "nvim-tree-lua" "nvim-treesitter-textsubjects" "nvim-ts-context-commentstring" "orgmode" "smartcolumn-nvim" "telescope-fzf-native-nvim" "telescope-nvim" "telescope-zoxide" "which-key-nvim" "todo-comments-nvim" ] ++ (with pkgs.vimPlugins; [ cmp-nvim-lsp cmp_luasnip copilot-cmp direnv-vim impatient-nvim lsp_lines-nvim lspkind-nvim lspsaga-nvim-original lualine-lsp-progress luasnip nui-nvim # for noice-nvim nvim-cmp nvim-lspconfig nvim-treesitter.withAllGrammars nvim-ufo nvim-web-devicons # for dashboard-nvim plenary-nvim # for telescope, neogit popup-nvim promise-async vim-lion ]); }; }; }; }