wrapper/rc: add vim.additionaLuafiles

Allows the user to specify a list of lua files that will be called via `luafile`. All paths
that are passed to this option are checked by `builtins.isPath` so attempting to source paths
that do not exist do not result in a broken Lua configuration.
This commit is contained in:
raf 2024-05-08 23:49:08 +03:00
commit 407ecf00d5
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
3 changed files with 57 additions and 9 deletions

View file

@ -133,6 +133,14 @@ in {
configRC = {
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
# Call additional lua files with :luafile in Vimscript
# section of the configuration, only after
# the luaScript section has been evaluated
extraLuaFiles = let
callLuaFiles = map (file: "luafile ${file}") cfg.extraLuaFiles;
in
entryAfter ["globalScript"] (concatStringsSep "\n" callLuaFiles);
# wrap the lua config in a lua block
# using the wrapLuaConfic function from the lib
luaScript = let
@ -148,7 +156,7 @@ in {
inherit mapResult;
};
in
entryAfter ["globalsScript"] luaConfig;
entryAnywhere luaConfig;
extraPluginConfigs = let
mapResult = result: (wrapLuaConfig {