From deb2f59b5c1fd11bec00600517ba7f51984c3090 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Tue, 28 Mar 2023 10:40:39 +0200 Subject: [PATCH] programs.neovim: link packpath dir in XDG_DATA_HOME (#3717) link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins. I sometimes need to run neovim not wrapped/configured by nix (when developing neovim or when other projects bring their own neovim in PATH). Currently they dont find plugins installed by home-manager in the cases where packpath is not set to the generated nix packpath directory. With this change, neovim can discover HM-installed plugins by itself. --- modules/programs/neovim.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index df4b487d6..b5733a8b9 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -394,6 +394,14 @@ in { home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; }; + # link the packpath in expected folder so that even unwrapped neovim can pick + # home-manager's plugins + xdg.dataFile = mkMerge (mapAttrsToList (name: val: { + "nvim/site" = { + source = pkgs.vimUtils.packDir neovimConfig.packpathDirs; + }; + }) neovimConfig.packpathDirs); + xdg.configFile = let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs; in mkMerge (