mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-25 07:59:48 +01:00
modules/nu: init (#477)
* modules/languages: add nu * configuration: enable nu for maximal * flake.lock: update nixpkgs * languages/nu: TS parser is now in nixpkgs * docs: added changelog entry for nu * modules/plugins/languages/nu.nix: applying suggested change for option ordering Co-authored-by: raf <raf@notashelf.dev> * configuration.nix: don't enable nu on maximal * modules/nu: removed useless comments * languages/nu: cleaning up after removing formatter code * modules/plugins/languages/nu.nix: better attrs ordering Co-authored-by: raf <raf@notashelf.dev> --------- Co-authored-by: diniamo <diniamo53@gmail.com> Co-authored-by: raf <raf@notashelf.dev>
This commit is contained in:
parent
5087c3d64d
commit
52ad5ec34c
5 changed files with 76 additions and 3 deletions
|
@ -76,6 +76,7 @@ isMaximal: {
|
||||||
csharp.enable = isMaximal;
|
csharp.enable = isMaximal;
|
||||||
julia.enable = isMaximal;
|
julia.enable = isMaximal;
|
||||||
vala.enable = isMaximal;
|
vala.enable = isMaximal;
|
||||||
|
nu.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals = {
|
visuals = {
|
||||||
|
|
|
@ -315,6 +315,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
the Typst language module.
|
the Typst language module.
|
||||||
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
|
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
|
||||||
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
|
- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec
|
||||||
|
- Add LSP and Treesitter support for Nushell under `vim.languages.nu`
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730958623,
|
"lastModified": 1732617236,
|
||||||
"narHash": "sha256-JwQZIGSYnRNOgDDoIgqKITrPVil+RMWHsZH1eE1VGN0=",
|
"narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "85f7e662eda4fa3a995556527c87b2524b691933",
|
"rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -33,6 +33,7 @@ in {
|
||||||
./zig.nix
|
./zig.nix
|
||||||
./csharp.nix
|
./csharp.nix
|
||||||
./julia.nix
|
./julia.nix
|
||||||
|
./nu.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages = {
|
options.vim.languages = {
|
||||||
|
|
70
modules/plugins/languages/nu.nix
Normal file
70
modules/plugins/languages/nu.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) str either package listOf;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (builtins) isList;
|
||||||
|
|
||||||
|
defaultServer = "nushell";
|
||||||
|
servers = {
|
||||||
|
nushell = {
|
||||||
|
package = pkgs.nushell;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.nushell.setup{
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/nu", "--no-config-file", "--lsp"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim.languages.nu;
|
||||||
|
in {
|
||||||
|
options.vim.languages.nu = {
|
||||||
|
enable = mkEnableOption "Nu language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Nu treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "nu";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = defaultServer;
|
||||||
|
description = "Nu LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[(lib.getExe pkgs.nushell) "--lsp"]'';
|
||||||
|
description = "Nu LSP server package, or the command to run as a list of strings";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.nu-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Reference in a new issue