Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/top-level/files/submodule.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name,
config,
lib,
pkgs,
helpers,
...
}:
Expand All @@ -17,11 +18,12 @@
config =
let
derivationName = "nvim-" + lib.replaceStrings [ "/" ] [ "-" ] name;
writeContent = if config.type == "lua" then helpers.writeLua else pkgs.writeText;
in
{
path = lib.mkDefault name;
type = lib.mkDefault (if lib.hasSuffix ".vim" name then "vim" else "lua");
# No need to use mkDerivedConfig; this option is readOnly.
plugin = helpers.writeLua derivationName config.content;
plugin = writeContent derivationName config.content;
};
}
16 changes: 0 additions & 16 deletions tests/modules/files.nix

This file was deleted.

29 changes: 29 additions & 0 deletions tests/test-sources/modules/files.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
after = {
files."after/ftplugin/python.lua" = {
localOpts.conceallevel = 1;

keymaps = [
{
mode = "n";
key = "<C-g>";
action = ":!python script.py<CR>";
options.silent = true;
}
];
};
};

vim-type = {
files."plugin/default_indent.vim".opts = {
shiftwidth = 2;
expandtab = true;
};

extraConfigLuaPost = ''
vim.cmd.runtime("plugin/default_indent.vim")
assert(vim.o.shiftwidth == 2, "shiftwidth is not set")
assert(vim.o.expandtab, "expandtab is not set")
'';
};
}