mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge branch 'v0.8' into nix/add-flake-formatter
This commit is contained in:
commit
33f67d217e
9 changed files with 215 additions and 11 deletions
|
@ -192,6 +192,7 @@ isMaximal: {
|
||||||
vim-wakatime.enable = false;
|
vim-wakatime.enable = false;
|
||||||
diffview-nvim.enable = true;
|
diffview-nvim.enable = true;
|
||||||
yanky-nvim.enable = false;
|
yanky-nvim.enable = false;
|
||||||
|
qmk-nvim.enable = false; # requires hardware specific options
|
||||||
icon-picker.enable = isMaximal;
|
icon-picker.enable = isMaximal;
|
||||||
surround.enable = isMaximal;
|
surround.enable = isMaximal;
|
||||||
leetcode-nvim.enable = isMaximal;
|
leetcode-nvim.enable = isMaximal;
|
||||||
|
|
|
@ -480,11 +480,14 @@
|
||||||
[roslyn-ls]: https://github.com/dotnet/vscode-csharp
|
[roslyn-ls]: https://github.com/dotnet/vscode-csharp
|
||||||
[jsonls]: https://github.com/microsoft/vscode/tree/1.101.2/extensions/json-language-features/server
|
[jsonls]: https://github.com/microsoft/vscode/tree/1.101.2/extensions/json-language-features/server
|
||||||
[jsonfmt]: https://github.com/caarlos0/jsonfmt
|
[jsonfmt]: https://github.com/caarlos0/jsonfmt
|
||||||
|
[superhtml]: https://github.com/kristoff-it/superhtml
|
||||||
|
[htmlHTML]: https://github.com/htmlhint/HTMLHint
|
||||||
|
[qmk-nvim]: https://github.com/codethread/qmk.nvim
|
||||||
|
|
||||||
- Add just support under `vim.languages.just` using [just-lsp].
|
- Add just support under `vim.languages.just` using [just-lsp].
|
||||||
|
|
||||||
- Add [roslyn-ls] to the `vim.languages.csharp` module.
|
- Add [roslyn-ls] to the `vim.languages.csharp` module.
|
||||||
|
- Add JSON support under `vim.languages.json` using [jsonls] and [jsonfmt].
|
||||||
- Added json support under `vim.languages.json` using [jsonls] and [jsonfmt].
|
- Add advanced HTML support under `vim.languages.html` using [superhtml] and
|
||||||
|
[htmlHINT].
|
||||||
- Add flake formatter type to the nix language module.
|
- Add QMK support under `vim.utility.qmk-nvim` via [qmk-nvim].
|
||||||
|
- Add flake formatter to the `vim.languages.nix` module.
|
||||||
|
|
|
@ -4,14 +4,44 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) bool;
|
inherit (lib.types) bool enum package;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics singleOrListOf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
cfg = config.vim.languages.html;
|
cfg = config.vim.languages.html;
|
||||||
|
|
||||||
|
defaultServers = ["superhtml"];
|
||||||
|
servers = {
|
||||||
|
superhtml = {
|
||||||
|
cmd = [(getExe pkgs.superhtml) "lsp"];
|
||||||
|
filetypes = ["html" "shtml" "htm"];
|
||||||
|
root_markers = ["index.html" ".git"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultFormat = "superhtml";
|
||||||
|
formats = {
|
||||||
|
superhtml = {
|
||||||
|
package = pkgs.writeShellApplication {
|
||||||
|
name = "superhtml_fmt";
|
||||||
|
runtimeInputs = [pkgs.superhtml];
|
||||||
|
text = "superhtml fmt -";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["htmlhint"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
htmlhint = {
|
||||||
|
config.cmd = getExe pkgs.htmlhint;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.html = {
|
options.vim.languages.html = {
|
||||||
enable = mkEnableOption "HTML language support";
|
enable = mkEnableOption "HTML language support";
|
||||||
|
@ -19,9 +49,44 @@ in {
|
||||||
enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
||||||
package = mkGrammarOption pkgs "html";
|
package = mkGrammarOption pkgs "html";
|
||||||
autotagHtml = mkOption {
|
autotagHtml = mkOption {
|
||||||
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
|
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "HTML LSP support" // {default = config.vim.lsp.enable;};
|
||||||
|
servers = mkOption {
|
||||||
|
type = singleOrListOf (enum (attrNames servers));
|
||||||
|
default = defaultServers;
|
||||||
|
description = "HTML LSP server to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "HTML formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "HTML formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "HTML formatter package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra HTML diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "HTML";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -41,5 +106,35 @@ in {
|
||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.servers =
|
||||||
|
mapListToAttrs (n: {
|
||||||
|
name = n;
|
||||||
|
value = servers.${n};
|
||||||
|
})
|
||||||
|
cfg.lsp.servers;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||||
|
vim.formatter.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.html = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.html = cfg.extraDiagnostics.types;
|
||||||
|
linters = mkMerge (map (name: {
|
||||||
|
${name} = diagnosticsProviders.${name}.config;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe' getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum package;
|
inherit (lib.types) enum package;
|
||||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
defaultServers = ["jsonls"];
|
defaultServers = ["jsonls"];
|
||||||
servers = {
|
servers = {
|
||||||
jsonls = {
|
jsonls = {
|
||||||
cmd = [(getExe pkgs.vscode-json-languageserver) "--stdio"];
|
cmd = [(getExe' pkgs.vscode-langservers-extracted "vscode-json-languageserver") "--stdio"];
|
||||||
filetypes = ["json" "jsonc"];
|
filetypes = ["json" "jsonc"];
|
||||||
init_options = {provideFormatter = true;};
|
init_options = {provideFormatter = true;};
|
||||||
root_markers = [".git"];
|
root_markers = [".git"];
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.json = {
|
options.vim.languages.json = {
|
||||||
enable = mkEnableOption "JSON langauge support";
|
enable = mkEnableOption "JSON language support";
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkEnableOption "JSON treesitter" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "JSON treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
./oil-nvim
|
./oil-nvim
|
||||||
./outline
|
./outline
|
||||||
./preview
|
./preview
|
||||||
|
./qmk-nvim
|
||||||
./sleuth
|
./sleuth
|
||||||
./smart-splits
|
./smart-splits
|
||||||
./snacks-nvim
|
./snacks-nvim
|
||||||
|
|
36
modules/plugins/utility/qmk-nvim/config.nix
Normal file
36
modules/plugins/utility/qmk-nvim/config.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.qmk-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["qmk-nvim"];
|
||||||
|
|
||||||
|
pluginRC.qmk-nvim = entryAfter ["nvim-notify"] ''
|
||||||
|
require('qmk').setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.setupOpts.variant == "qmk" && cfg.setupOpts.comment_preview.position != "inside";
|
||||||
|
message = "comment_preview.position can only be set to inside when using the qmk layoyt";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.setupOpts.name != null;
|
||||||
|
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.name' to be set.";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.setupOpts.layout != null;
|
||||||
|
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.layout' to be set.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/utility/qmk-nvim/default.nix
Normal file
6
modules/plugins/utility/qmk-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./qmk-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
49
modules/plugins/utility/qmk-nvim/qmk-nvim.nix
Normal file
49
modules/plugins/utility/qmk-nvim/qmk-nvim.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) attrsOf nullOr enum lines str;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.qmk-nvim = {
|
||||||
|
enable = mkEnableOption "QMK and ZMK keymaps in nvim";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "qmk.nvim" {
|
||||||
|
name = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "The name of the layout";
|
||||||
|
};
|
||||||
|
|
||||||
|
layout = mkOption {
|
||||||
|
type = nullOr lines;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The keyboard key layout
|
||||||
|
see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
variant = mkOption {
|
||||||
|
type = enum ["qmk" "zmk"];
|
||||||
|
default = "qmk";
|
||||||
|
description = "Chooses the expected hardware target";
|
||||||
|
};
|
||||||
|
|
||||||
|
comment_preview = {
|
||||||
|
position = mkOption {
|
||||||
|
type = enum ["top" "bottom" "inside" "none"];
|
||||||
|
default = "top";
|
||||||
|
description = "Controls the position of the preview";
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap_overrides = mkOption {
|
||||||
|
type = attrsOf str;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Key codes to text replacements
|
||||||
|
see <https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua> for more details
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -2186,6 +2186,19 @@
|
||||||
"url": "https://github.com/kevinhwang91/promise-async/archive/119e8961014c9bfaf1487bf3c2a393d254f337e2.tar.gz",
|
"url": "https://github.com/kevinhwang91/promise-async/archive/119e8961014c9bfaf1487bf3c2a393d254f337e2.tar.gz",
|
||||||
"hash": "0q4a0rmy09hka6zvydzjj2gcm2j5mlbrhbxfcdjj33ngpblkmqzm"
|
"hash": "0q4a0rmy09hka6zvydzjj2gcm2j5mlbrhbxfcdjj33ngpblkmqzm"
|
||||||
},
|
},
|
||||||
|
"qmk-nvim": {
|
||||||
|
"type": "Git",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "codethread",
|
||||||
|
"repo": "qmk.nvim"
|
||||||
|
},
|
||||||
|
"branch": "main",
|
||||||
|
"submodules": false,
|
||||||
|
"revision": "3c804c1480991e4837514900b22b9358cfd64fa1",
|
||||||
|
"url": "https://github.com/codethread/qmk.nvim/archive/3c804c1480991e4837514900b22b9358cfd64fa1.tar.gz",
|
||||||
|
"hash": "03fsx6qsn8b36jp5m0fkdla6gkkzdv2j18y378y3cqpjclgq995a"
|
||||||
|
},
|
||||||
"rainbow-delimiters-nvim": {
|
"rainbow-delimiters-nvim": {
|
||||||
"type": "Git",
|
"type": "Git",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue