lsp/presets/nimlsp: init

This commit is contained in:
Snoweuph 2026-04-11 18:09:47 +02:00
commit a8e4dc1817
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
inherit (lib.generators) mkLuaInline;
cfg = config.vim.lsp.presets.nimlsp;
in {
options.vim.lsp.presets.nimlsp = {
enable = mkEnableOption "the Nim Language Server";
};
config = mkIf cfg.enable {
vim.lsp.servers.nimlsp = {
enable = true;
cmd = [(getExe pkgs.nimlsp)];
root_dir = mkLuaInline ''
function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(
util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
)
end
'';
};
};
}