fix(nvim): test dev.enable = false #132

Merged
jalil merged 1 commit from test-headless-nvim into main 2024-11-06 22:30:43 +01:00
3 changed files with 277 additions and 249 deletions
Showing only changes of commit 84387f2597 - Show all commits

View file

@ -1,4 +1,4 @@
{ inputs, ... }: { inputs, lib, ... }:
{ {
flake.overlays.nixvim = inputs.nixvim.overlays.default; flake.overlays.nixvim = inputs.nixvim.overlays.default;
@ -7,7 +7,7 @@
let let
nixvimLib = inputs.nixvim.lib.${system}; nixvimLib = inputs.nixvim.lib.${system};
nixvim = inputs.nixvim.legacyPackages.${system}; nixvim = inputs.nixvim.legacyPackages.${system};
module = { moduleDev = {
inherit pkgs; inherit pkgs;
extraSpecialArgs = { extraSpecialArgs = {
inherit (inputs) unstable; inherit (inputs) unstable;
@ -15,12 +15,24 @@
}; };
module = import ../nvim/standalone.nix { standalone = true; }; module = import ../nvim/standalone.nix { standalone = true; };
}; };
moduleHeadless = {
inherit pkgs;
extraSpecialArgs = {
inherit (inputs) unstable;
inherit system;
};
module = {
imports = [ (import ../nvim/standalone.nix { standalone = true; }) ];
config.jhome.nvim.dev.enable = false;
};
};
in in
{ {
# Check standalone nvim build # Check standalone nvim build
checks.nvim = nixvimLib.check.mkTestDerivationFromNixvimModule module; checks.nvimDev = nixvimLib.check.mkTestDerivationFromNixvimModule moduleDev;
checks.nvimHeadless = nixvimLib.check.mkTestDerivationFromNixvimModule moduleHeadless;
# Nvim standalone module # Nvim standalone module
packages.nvim = nixvim.makeNixvimWithModule module; packages.nvim = nixvim.makeNixvimWithModule moduleDev;
}; };
} }

View file

@ -1,6 +1,13 @@
{ helpers, ... }: {
config,
helpers,
lib,
...
}:
let let
inherit (helpers) mkRaw; inherit (helpers) mkRaw;
cfg = config.jhome.nvim;
dev = cfg.dev.enable;
in in
{ {
config = { config = {
@ -9,7 +16,8 @@ in
"lspConfig" = { }; "lspConfig" = { };
"restoreCursorPosition" = { }; "restoreCursorPosition" = { };
}; };
autoCmd = [ autoCmd =
[
{ {
group = "highlightOnYank"; group = "highlightOnYank";
event = "TextYankPost"; event = "TextYankPost";
@ -43,7 +51,8 @@ in
end end
''; '';
} }
{ ]
++ lib.optional dev {
group = "lspConfig"; group = "lspConfig";
event = "LspAttach"; event = "LspAttach";
pattern = "*"; pattern = "*";
@ -94,7 +103,6 @@ in
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} }) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
end end
''; '';
} };
];
}; };
} }

View file

@ -1,9 +1,17 @@
{ helpers, ... }: {
lib,
config,
helpers,
...
}:
let let
inherit (helpers) mkRaw; inherit (helpers) mkRaw;
cfg = config.jhome.nvim;
dev = cfg.dev.enable;
in in
{ {
config.keymaps = [ config.keymaps =
[
# Quickfix # Quickfix
{ {
mode = "n"; mode = "n";
@ -194,17 +202,6 @@ in
''; '';
options.desc = "Find Quickfix"; options.desc = "Find Quickfix";
} }
{
mode = "n";
key = "<leader>w";
action =
mkRaw
# lua
''
require('conform').format
'';
options.desc = "Format buffer";
}
# Nvim Silicon # Nvim Silicon
{ {
mode = "v"; mode = "v";
@ -218,5 +215,16 @@ in
''; '';
options.desc = "Snap Code (to clipboard)"; options.desc = "Snap Code (to clipboard)";
} }
]; ]
++ lib.optional dev {
mode = "n";
key = "<leader>w";
action =
mkRaw
# lua
''
require('conform').format
'';
options.desc = "Format buffer";
};
} }