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,41 +16,43 @@ in
"lspConfig" = { }; "lspConfig" = { };
"restoreCursorPosition" = { }; "restoreCursorPosition" = { };
}; };
autoCmd = [ autoCmd =
{ [
group = "highlightOnYank"; {
event = "TextYankPost"; group = "highlightOnYank";
pattern = "*"; event = "TextYankPost";
callback = pattern = "*";
mkRaw callback =
# lua mkRaw
'' # lua
function() ''
vim.highlight.on_yank { function()
higroup = ( vim.highlight.on_yank {
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch' higroup = (
), vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
timeout = 200, ),
} timeout = 200,
end }
'';
}
{
group = "restoreCursorPosition";
event = "BufReadPost";
pattern = "*";
callback =
mkRaw
# lua
''
function()
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
vim.cmd [[execute "normal! g'\""]]
end end
end '';
''; }
} {
{ group = "restoreCursorPosition";
event = "BufReadPost";
pattern = "*";
callback =
mkRaw
# lua
''
function()
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
vim.cmd [[execute "normal! g'\""]]
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,200 +1,222 @@
{ 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"; {
key = "<leader>qo"; mode = "n";
action = "<cmd>Copen<CR>"; key = "<leader>qo";
options.desc = "Quickfix Open"; action = "<cmd>Copen<CR>";
} options.desc = "Quickfix Open";
{ }
mode = "n"; {
key = "<leader>qq"; mode = "n";
action = "<cmd>cclose<CR>"; key = "<leader>qq";
options.desc = "Quickfix Quit"; action = "<cmd>cclose<CR>";
} options.desc = "Quickfix Quit";
{ }
mode = "n"; {
key = "<leader>qj"; mode = "n";
action = "<cmd>cnext<CR>"; key = "<leader>qj";
options.desc = "Quickfix next [J]"; action = "<cmd>cnext<CR>";
} options.desc = "Quickfix next [J]";
{ }
mode = "n"; {
key = "<leader>qk"; mode = "n";
action = "<cmd>cprev<CR>"; key = "<leader>qk";
options.desc = "Quickfix previous [K]"; action = "<cmd>cprev<CR>";
} options.desc = "Quickfix previous [K]";
# Open or create file }
{ # Open or create file
mode = "n"; {
key = "<leader>gf"; mode = "n";
action = "<cmd>e <cfile><CR>"; key = "<leader>gf";
options.desc = "Go to File"; action = "<cmd>e <cfile><CR>";
} options.desc = "Go to File";
# Keep Selection when indenting }
{ # Keep Selection when indenting
mode = "x"; {
key = ">"; mode = "x";
action = ">gv"; key = ">";
options.desc = "Indent Selection"; action = ">gv";
} options.desc = "Indent Selection";
{ }
mode = "x"; {
key = "<"; mode = "x";
action = "<gv"; key = "<";
options.desc = "Deindent Selection"; action = "<gv";
} options.desc = "Deindent Selection";
# Diagnostics }
{ # Diagnostics
mode = "n"; {
key = "<leader>dj"; mode = "n";
action = key = "<leader>dj";
mkRaw action =
# lua mkRaw
'' # lua
vim.diagnostic.goto_next ''
''; vim.diagnostic.goto_next
options.desc = "Diagnostics next [J]"; '';
} options.desc = "Diagnostics next [J]";
{ }
mode = "n"; {
key = "<leader>dk"; mode = "n";
action = key = "<leader>dk";
mkRaw action =
# lua mkRaw
'' # lua
vim.diagnostic.goto_prev ''
''; vim.diagnostic.goto_prev
options.desc = "Diagnostics previous [K]"; '';
} options.desc = "Diagnostics previous [K]";
{ }
mode = "n"; {
key = "<leader>xs"; mode = "n";
action = key = "<leader>xs";
mkRaw action =
# lua mkRaw
'' # lua
function() require('trouble').toggle_preview('symbols') end ''
''; function() require('trouble').toggle_preview('symbols') end
options.desc = "Toggle Diagnostics trouble"; '';
} options.desc = "Toggle Diagnostics trouble";
{ }
mode = "n"; {
key = "<leader>xd"; mode = "n";
action = key = "<leader>xd";
mkRaw action =
# lua mkRaw
'' # lua
function() require('trouble').toggle_preview('diagnostics') end ''
''; function() require('trouble').toggle_preview('diagnostics') end
options.desc = "Toggle Diagnostics trouble"; '';
} options.desc = "Toggle Diagnostics trouble";
{ }
mode = "n"; {
key = "<leader>xq"; mode = "n";
action = key = "<leader>xq";
mkRaw action =
# lua mkRaw
'' # lua
function() require('trouble').toggle_preview('quickfix') end ''
''; function() require('trouble').toggle_preview('quickfix') end
options.desc = "Toggle Quickfix trouble"; '';
} options.desc = "Toggle Quickfix trouble";
{ }
mode = "n"; {
key = "<leader>xl"; mode = "n";
action = key = "<leader>xl";
mkRaw action =
# lua mkRaw
'' # lua
function() require('trouble').toggle_preview('loclist') end ''
''; function() require('trouble').toggle_preview('loclist') end
options.desc = "Toggle Loclist trouble"; '';
} options.desc = "Toggle Loclist trouble";
{ }
mode = "n"; {
key = "gR"; mode = "n";
action = key = "gR";
mkRaw action =
# lua mkRaw
'' # lua
function() require('trouble').toggle_preview('lsp_references') end ''
''; function() require('trouble').toggle_preview('lsp_references') end
options.desc = "Toggle lsp References trouble"; '';
} options.desc = "Toggle lsp References trouble";
# Telescope }
{ # Telescope
mode = "n"; {
key = "<leader>ff"; mode = "n";
action = key = "<leader>ff";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').find_files ''
''; require('telescope.builtin').find_files
options.desc = "Find Files"; '';
} options.desc = "Find Files";
{ }
mode = "n"; {
key = "<leader>fg"; mode = "n";
action = key = "<leader>fg";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').live_grep ''
''; require('telescope.builtin').live_grep
options.desc = "Find Grep"; '';
} options.desc = "Find Grep";
{ }
mode = "n"; {
key = "<leader>fh"; mode = "n";
action = key = "<leader>fh";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').help_tags ''
''; require('telescope.builtin').help_tags
options.desc = "Find Help"; '';
} options.desc = "Find Help";
{ }
mode = "n"; {
key = "<leader>fb"; mode = "n";
action = key = "<leader>fb";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').buffers ''
''; require('telescope.builtin').buffers
options.desc = "Find Buffer"; '';
} options.desc = "Find Buffer";
{ }
mode = "n"; {
key = "<leader>fd"; mode = "n";
action = key = "<leader>fd";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').diagnostics ''
''; require('telescope.builtin').diagnostics
options.desc = "Find Diagnostics"; '';
} options.desc = "Find Diagnostics";
{ }
mode = "n"; {
key = "<leader>fq"; mode = "n";
action = key = "<leader>fq";
mkRaw action =
# lua mkRaw
'' # lua
require('telescope.builtin').quickfix ''
''; require('telescope.builtin').quickfix
options.desc = "Find Quickfix"; '';
} options.desc = "Find Quickfix";
{ }
# Nvim Silicon
{
mode = "v";
key = "<leader>sc";
action =
mkRaw
# lua
''
require('nvim-silicon').clip
'';
options.desc = "Snap Code (to clipboard)";
}
]
++ lib.optional dev {
mode = "n"; mode = "n";
key = "<leader>w"; key = "<leader>w";
action = action =
@ -204,19 +226,5 @@ in
require('conform').format require('conform').format
''; '';
options.desc = "Format buffer"; options.desc = "Format buffer";
} };
# Nvim Silicon
{
mode = "v";
key = "<leader>sc";
action =
mkRaw
# lua
''
require('nvim-silicon').clip
'';
options.desc = "Snap Code (to clipboard)";
}
];
} }