mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-01-10 15:49:48 +01:00
Compare commits
No commits in common. "35c7327f81bcf9ff0358c37962838714636e0c92" and "2759b9caae4f078b3e86fc697c56490a5a72d7ef" have entirely different histories.
35c7327f81
...
2759b9caae
3 changed files with 5 additions and 50 deletions
|
@ -49,9 +49,3 @@ Release notes for release 0.7
|
||||||
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
|
- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.
|
||||||
|
|
||||||
- Fix Emac typo
|
- Fix Emac typo
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
|
||||||
|
|
||||||
- Move the `theme` dag entry to before `luaScript`.
|
|
||||||
|
|
||||||
- Add rustfmt as the default formatter for Rust
|
|
||||||
|
|
|
@ -4,33 +4,17 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.lists) isList optionals;
|
inherit (lib.lists) isList optionals;
|
||||||
inherit (lib.types) bool package str listOf either enum;
|
inherit (lib.types) bool package str listOf either;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.rust;
|
cfg = config.vim.languages.rust;
|
||||||
|
|
||||||
defaultFormat = "rustfmt";
|
|
||||||
formats = {
|
|
||||||
rustfmt = {
|
|
||||||
package = pkgs.rustfmt;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.rustfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/rustfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
options.vim.languages.rust = {
|
options.vim.languages.rust = {
|
||||||
enable = mkEnableOption "Rust language support";
|
enable = mkEnableOption "Rust language support";
|
||||||
|
@ -65,22 +49,6 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
format = {
|
|
||||||
enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;};
|
|
||||||
|
|
||||||
type = mkOption {
|
|
||||||
description = "Rust formatter to use";
|
|
||||||
type = enum (attrNames formats);
|
|
||||||
default = defaultFormat;
|
|
||||||
};
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
description = "Rust formatter package";
|
|
||||||
type = package;
|
|
||||||
default = formats.${cfg.format.type}.package;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
dap = {
|
dap = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Rust Debug Adapter support";
|
description = "Rust Debug Adapter support";
|
||||||
|
@ -118,11 +86,6 @@ in {
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
|
||||||
vim.lsp.null-ls.enable = true;
|
|
||||||
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||||
|
|
|
@ -45,12 +45,10 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [cfg.name];
|
startPlugins = [cfg.name];
|
||||||
configRC.theme = entryBefore ["luaScript"] ''
|
luaConfigRC = {
|
||||||
lua << EOF
|
themeSetup = entryBefore ["theme"] cfg.extraConfig;
|
||||||
${cfg.extraConfig}
|
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
|
||||||
${supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;})}
|
};
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue