From de3758e31a3a1bc79d569f5deb5dac39791bf9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joosep=20J=C3=A4=C3=A4ger?= Date: Fri, 23 Sep 2022 11:33:17 +0000 Subject: [PATCH] neovim: fix a typo in the generated init.lua (#3252) neovim complains when having both an init.lua and an init.vim --- modules/programs/neovim.nix | 9 +++++---- tests/modules/programs/neovim/plugin-config.nix | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index a5bcc463..88683e40 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -365,13 +365,14 @@ in { in mkMerge ( # writes runtime (map (x: x.runtime) pluginsNormalized) ++ [{ - "nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { - text = neovimConfig.neovimRcContent; - }; + "nvim/init-home-manager.vim" = + mkIf (neovimConfig.neovimRcContent != "") { + text = neovimConfig.neovimRcContent; + }; "nvim/init.lua" = let luaRcContent = lib.optionalString (neovimConfig.neovimRcContent != "") - "vim.cmd.source ${config.xdg.configHome}/nvim/init.vim" + "vim.cmd [[source ${config.xdg.configHome}/nvim/init-home-manager.vim]]" + lib.optionalString hasLuaConfig config.programs.neovim.generatedConfigs.lua; in mkIf (luaRcContent != "") { text = luaRcContent; }; diff --git a/tests/modules/programs/neovim/plugin-config.nix b/tests/modules/programs/neovim/plugin-config.nix index 9647fb5a..843330b9 100644 --- a/tests/modules/programs/neovim/plugin-config.nix +++ b/tests/modules/programs/neovim/plugin-config.nix @@ -24,7 +24,7 @@ with lib; }; nmt.script = '' - vimrc="$TESTED/home-files/.config/nvim/init.vim" + vimrc="$TESTED/home-files/.config/nvim/init-home-manager.vim" vimrcNormalized="$(normalizeStorePaths "$vimrc")" assertFileExists "$vimrc"