Skip to content

Commit

Permalink
Switch to neotest
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed May 21, 2024
1 parent 97e5fb9 commit e64d30b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
4 changes: 3 additions & 1 deletion home/nixvim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ in {
./trouble.nix
./zen-mode.nix
./vim-test.nix
./neotest.nix
];
config = {
# custom overrides
Expand All @@ -54,7 +55,8 @@ in {
context.enable = true;
octo-nvim.enable = true;
oil.enable = true;
vim-test.enable = true;
vim-test.enable = false;
neotest.enable = true;
};
# defaults
programs.nixvim = {
Expand Down
48 changes: 48 additions & 0 deletions home/nixvim/neotest.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
lib,
config,
...
}:
with lib; let
keymap = {
key,
action,
mode ? "n",
lua ? true,
}: {
inherit action mode key lua;
options = {
noremap = true;
silent = true;
};
};
cfg = config.me.nixvim.neotest;
in {
options.me.nixvim.neotest.enable = mkEnableOption "neotest";
config = mkIf cfg.enable {
programs.nixvim = {
plugins.neotest = {
enable = true;
adapters = {
go.enable = true;
python.enable = true;
rust.enable = true;
};
};
keymaps = [
(keymap {
key = "tf";
action = ''require("neotest").run.run(vim.fn.expand("%"))'';
})
(keymap {
key = "tl";
action = ''require("neotest").run.run_last()'';
})
(keymap {
key = "tn";
action = ''require("neotest").run.run()'';
})
];
};
};
}

0 comments on commit e64d30b

Please sign in to comment.