From 8e6fe1873e3230ab2f3627d70cd356ad2c4bd40e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 20 Jul 2024 14:46:24 +0300 Subject: [PATCH 1/3] modules: add helpers to display init.lua and its store path --- modules/default.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/default.nix b/modules/default.nix index fbcdb701d..093844755 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -105,10 +105,30 @@ inputs: { inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3; inherit extraLuaPackages extraPython3Packages; }; + + # Additional helper scripts for printing and displaying nvf configuration + # in your commandline. + printConfig = pkgs.writeShellScriptBin "print-nvf-config" '' + cat << EOF + ${vimOptions.builtLuaConfigRC} + EOF + ''; + + printConfigPath = pkgs.writeShellScriptBin "print-nvf-config-path" '' + realpath ${pkgs.writeTextFile { + name = "nvf-init.lua"; + text = vimOptions.builtLuaConfigRC; + }} + ''; in { inherit (module) options config; inherit (module._module.args) pkgs; - # expose wrapped neovim-package - neovim = neovim-wrapped; + # Expose wrapped neovim-package for userspace + # or module consumption. + neovim = pkgs.symlinkJoin { + name = "nvf-with-helpers"; + paths = [neovim-wrapped printConfig printConfigPath]; + postBuild = "echo helpers added"; + }; } From e673552df6da6b494438aa67af70d3bb8fee568e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 20 Jul 2024 14:50:28 +0300 Subject: [PATCH 2/3] docs: update 0.7 release notes --- docs/release-notes/rl-0.7.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index c1b05bc6d..e35549e21 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -141,3 +141,11 @@ configuration formats. - Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available under `vim.filetree.neo-tree`, similar to nvimtree. + +- Add `print-nvf-config` & `print-nvf-config-path` helper scripts to Neovim + closure. Both of those scripts have been automatically added to your PATH upon + using neovimConfig or `programs.nvf.enable`. + - `print-nvf-config` will display your `init.lua`, in full. + - `print-nvf-config-path` will display the path to _a clone_ of your + `init.lua`. This is not the path used by the Neovim wrapper, but an + identical clone. From 51155a32ed74c8c48854099935da20ec11bbf3c4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 20 Jul 2024 15:34:35 +0300 Subject: [PATCH 3/3] modules: use writeDashBin for helpers --- modules/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default.nix b/modules/default.nix index 093844755..209974948 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -108,13 +108,13 @@ inputs: { # Additional helper scripts for printing and displaying nvf configuration # in your commandline. - printConfig = pkgs.writeShellScriptBin "print-nvf-config" '' + printConfig = pkgs.writers.writeDashBin "print-nvf-config" '' cat << EOF ${vimOptions.builtLuaConfigRC} EOF ''; - printConfigPath = pkgs.writeShellScriptBin "print-nvf-config-path" '' + printConfigPath = pkgs.writers.writeDashBin "print-nvf-config-path" '' realpath ${pkgs.writeTextFile { name = "nvf-init.lua"; text = vimOptions.builtLuaConfigRC;