Skip to content

Commit f114479

Browse files
committed
add nix function to generate plugin list to README
1 parent 2b05502 commit f114479

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ To update this configuration to work with Lazy-Nix-Helper, we will:
122122

123123
Update the configuration as follows:
124124
```Lua
125-
-- See the NixOS Configuration section for more details on plugins table and lazy_nix_helper_path
125+
-- THIS PLUGIN LIST SHOULD BE GENERATED BY YOUR NIX CONFIG. See the NixOS Configuration section for more details on plugins table and lazy_nix_helper_path
126126
local plugins = {
127127
["plugin-name.nvim"] = "nix/store/hash1234-vimplugin-plugin-name.nvim",
128128
...
@@ -296,8 +296,14 @@ let
296296
};
297297
};
298298
299-
TODO: include function to generate plugins table
300-
pluginTable = x:
299+
sanitizePluginName = input:
300+
let
301+
name = lib.strings.getName input;
302+
intermediate = lib.strings.removePrefix "vimplugin-" name;
303+
result = lib.strings.removePrefix "lua5.1-" intermediate;
304+
in result;
305+
306+
pluginList = plugins: lib.strings.concatMapStrings (plugin: " [\"${sanitizePluginName plugin.name}\"] = \"${plugin.outPath}\",\n") plugins;
301307
302308
in
303309
{
@@ -319,7 +325,7 @@ in
319325
];
320326
extraLuaConfig = ''
321327
local plugins = {
322-
${pluginTable config.programs.neovim.plugins}
328+
${pluginList config.programs.neovim.plugins}
323329
}
324330
local lazy_nix_helper_path = "${lazy-nix-helper-nvim}"
325331
if not vim.loop.fs_stat(lazy_nix_helper_path) then

0 commit comments

Comments
 (0)