{ lib , stdenv , runCommand , writeShellScriptBin , writeTextFile , neovim-unwrapped , makeWrapper , tree-sitter , fd , ripgrep , html-tidy , node-lsp , fetchFromGitHub , fetchpatch , withLuadev ? false }: let buildNeovimPlugin = attrs: stdenv.mkDerivation ({ forceShare= [ "man" "info" ]; installPhase = '' cp -r . $out if [ -d "$out/doc" ]; then ${neovim-unwrapped}/bin/nvim -N -u NONE -i NONE -n -E -s -V1 -c "helptags $out/doc" +quit! fi ''; } // attrs); extra-treesitter-textobjects = writeTextFile { name = "extra-treesitter-textobjects"; destination = "/queries/ecma/textobjects.scm"; text = '' ;; extends ; consider array elements as @parameter text objects too (array "," @_start . (_) @parameter.inner (#make-range! "parameter.outer" @_start @parameter.inner)) (array . (_) @parameter.inner . ","? @_end (#make-range! "parameter.outer" @parameter.inner @_end)) ''; }; tsc = writeShellScriptBin "tsc" '' if [ -x "./node_modules/.bin/tsc" ]; then exec ./node_modules/.bin/tsc "$@" else exec ${node-lsp}/lib/node_modules/.bin/tsc "$@" fi ''; extraPath = [ fd ripgrep html-tidy node-lsp tsc ]; pinnedPlugins = import ./plugins { inherit buildNeovimPlugin fetchFromGitHub fetchpatch; }; treesitterPlugins = import ./treesitter { inherit lib runCommand fetchFromGitHub tree-sitter; }; plugins = (builtins.filter (p: !p.optional) (lib.attrValues pinnedPlugins)) ++ (lib.attrValues treesitterPlugins) ++ [ extra-treesitter-textobjects ] ++ lib.optionals withLuadev [ pinnedPlugins."bfredl/nvim-luadev" ]; generic = { initText ? "", enabledPlugins ? [], passthru ? {} }: stdenv.mkDerivation { pname = "nvim"; version = neovim-unwrapped.version; initVim = '' let g:loaded_python3_provider = 0 let g:loaded_ruby_provider = 0 let g:loaded_node_provider = 0 let g:loaded_perl_provider = 0 set runtimepath=${placeholder "out"}/lib,$VIMRUNTIME set packpath=${placeholder "out"}/lib lua <