{ config, lib, pkgs, ... }: let xdg-data = config.xdg.dataHome; xdg-cache = config.xdg.cacheHome; mythic-nvim = pkgs.vimUtils.buildVimPlugin { name = "mythic-nvim"; namePrefix = ""; src = pkgs.fetchgit { url = "https://git.dyamon.me/vim/mythic.nvim/"; rev = "1b57af77d13478105134feb49d3d791b84b6f4a7"; hash = "sha256-LqcMqZ0h9ysR8gvkCoVK7Z4X0nOVVN52WKBLyK0s8Sc="; }; }; cppman = { cache = "${xdg-cache}/cppman"; package = with pkgs.python311Packages; buildPythonApplication rec { pname = "cppman"; version = "0.5.7"; format = "setuptools"; src = pkgs.fetchPypi { inherit pname version; hash = "sha256-AIcpQW51TdL0tZ34NJbLNsgXRgX17QKBPH0ow2xWDxo="; }; doCheck = false; propagatedBuildInputs = [ beautifulsoup4 html5lib ]; }; }; in { imports = [ ./nnn.nix ]; home.sessionVariables.EDITOR = "nvim"; home.sessionVariables.MERGE_EDITOR = "nvim -d"; home.activation = { checkCppManCache = lib.hm.dag.entryBefore ["writeBoundary"] '' if [ ! -d '${cppman.cache}' ] || [ -z "$(ls -1A '${cppman.cache}')" ]; then $DRY_RUN_CMD echo "Cache CppMan pages for offline use in ${cppman.cache} with 'cppman --cache-all'." fi ''; setupNeovim = lib.hm.dag.entryAfter ["writeBoundary"] '' $DRY_RUN_CMD mkdir $VERBOSE_ARG -p ${xdg-data}/nvim/{backup,sessions,swap,undo} ''; }; home.packages = [ cppman.package ]; programs.neovim = { enable = true; viAlias = true; vimAlias = true; vimdiffAlias = true; extraPackages = with pkgs; [ xclip # Clipboard provider (:help clipboard) ripgrep # Required by 'telescope-nvim' clang # Required by 'nvim-treesitter' universal-ctags # Ctags generator ]; plugins = let optional = p: { plugin = p; optional = true; }; personal = [ mythic-nvim ]; official = with pkgs.vimPlugins; [ aerial-nvim conform-nvim dressing-nvim gitsigns-nvim harpoon2 nlsp-settings-nvim nvim-dap nvim-dap-ui nvim-lspconfig nvim-ufo promise-async onedarkpro-nvim telescope-fzf-native-nvim telescope-nvim undotree vim-fugitive vim-nix vim-obsession vim-pandoc-syntax (optional vim-slime) vim-surround zen-mode-nvim # 'nvim-treesitter' with grammars # NOTE upstream versions of grammars are not necessarily # compatible as 'nvim-treesitter' has its own lockfile to # determine compatible grammars. (nvim-treesitter.withPlugins (p: with p; [ vim vimdoc query lua markdown nix c cpp rust ocaml ocaml_interface ])) nvim-treesitter-context nvim-treesitter-textobjects # TODO nvim-treesitter-cpp-tools ]; extra = with pkgs.vimExtraPlugins; [ hlchunk-nvim neovim-tasks nnn-nvim ]; in personal ++ official ++ extra; }; xdg.configFile.neovim = { source = config/neovim/nvim; target = "nvim"; }; home.sessionVariables = { NVIM_SESSIONS = "${xdg-data}/nvim/sessions"; }; programs.bash.bashrcExtra = lib.mkBefore ('' export MANPATH="$MANPATH:${cppman.cache}" '' + ( builtins.readFile config/neovim/bash/functions.bash )); }