mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 10:44:34 +02:00
Use init.lua instead of init.vim (#64)
* Use init.lua instead of init.vim * fix standalone generation Co-authored-by: cyrusng <cyrus.ng@protonmail.com> Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
parent
1fa86d1699
commit
3849a1de9a
4 changed files with 24 additions and 18 deletions
|
@ -79,7 +79,7 @@ in
|
|||
|
||||
initContent = mkOption {
|
||||
type = types.str;
|
||||
description = "The content of the init.vim file";
|
||||
description = "The content of the init.lua file";
|
||||
readOnly = true;
|
||||
visible = false;
|
||||
};
|
||||
|
@ -89,15 +89,16 @@ in
|
|||
let
|
||||
customRC =
|
||||
(optionalString (config.extraConfigLuaPre != "") ''
|
||||
lua <<EOF
|
||||
${config.extraConfigLuaPre}
|
||||
EOF
|
||||
'') +
|
||||
config.extraConfigVim + (optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
lua <<EOF
|
||||
(optionalString (config.extraConfigVim != "") ''
|
||||
vim.cmd([[
|
||||
${config.extraConfigVim}
|
||||
]])
|
||||
'') +
|
||||
(optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
EOF
|
||||
'');
|
||||
|
||||
defaultPlugin = {
|
||||
|
@ -109,7 +110,7 @@ in
|
|||
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) config.extraPlugins;
|
||||
|
||||
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
||||
inherit customRC;
|
||||
# inherit customRC;
|
||||
plugins = normalizedPlugins;
|
||||
}
|
||||
# Necessary to make sure the runtime path is set properly in NixOS 22.05,
|
||||
|
@ -120,12 +121,17 @@ in
|
|||
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
||||
});
|
||||
|
||||
extraWrapperArgs = optionalString (config.extraPackages != [ ])
|
||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'';
|
||||
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||
(optional (config.extraPackages != [ ])
|
||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
||||
++
|
||||
(optional (config.wrapRc)
|
||||
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
|
||||
);
|
||||
|
||||
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig // {
|
||||
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
||||
inherit (config) wrapRc;
|
||||
wrapRc = false;
|
||||
});
|
||||
in
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue