Compare commits

...

2 commits

Author SHA1 Message Date
irobot
92854bd0ea
Keymap/extra options (#1384)
Some checks failed
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate documentation builds-1 (push) Waiting to run
Treewide Checks / Validate documentation builds-2 (push) Waiting to run
Treewide Checks / Validate documentation builds-3 (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* keymaps: fix unable to set noremap = false

Currently setting `vim.keymaps.*.noremap = false` has no effect.
Given that noremap is set by default, the only way to undo it is
to use `remap = true`. This commit adds `remap` as an internal option,
and derives its final value as the inverse of noremap.
This way, setting `noremap` to `false` now behaves as expected.

See https://neovim.io/doc/user/lua-guide.html#_creating-mappings

* keymaps/config: fix formatting

merge unnecessarily split attrset

* keymaps/options: remove unnecessary option

+ tweak related release notes entry
2026-02-03 15:52:39 +01:00
Snoweuph
7db4da419e
language/make: add treesitter, formatter and diagnostics support (#1380) 2026-02-03 11:08:50 +00:00
5 changed files with 103 additions and 0 deletions

View file

@ -92,6 +92,7 @@ isMaximal: {
ruby.enable = false;
fsharp.enable = false;
just.enable = false;
make.enable = false;
qml.enable = false;
jinja.enable = false;
tailwind.enable = false;

View file

@ -172,10 +172,17 @@
- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics.
- Added Makefile support via `languages.make`.
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
https://github.com/gorbit99/codewindow.nvim
- Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and
`setupOpts`
[irobot](https://github.com/irobot):
- Fix non-functional `vim.keymaps.*.noremap`. Now, setting it to false is
equivalent to `:lua vim.keymap.set(..., { remap = true })`
<!-- vim: set textwidth=80: -->

View file

@ -52,6 +52,7 @@ in {
./yaml.nix
./ruby.nix
./just.nix
./make.nix
./xml.nix
# This is now a hard deprecation.

View file

@ -0,0 +1,93 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.types) listOf enum;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.make;
defaultFormat = ["bake"];
formats = {
bake = {
command = "${pkgs.mbake}/bin/mbake";
};
};
defaultDiagnosticsProvider = ["checkmake"];
diagnosticsProviders = {
checkmake = {
config = {
cmd = getExe pkgs.checkmake;
};
};
};
in {
options.vim.languages.make = {
enable = mkEnableOption "Make support";
treesitter = {
enable = mkEnableOption "Make treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "make";
};
format = {
enable = mkEnableOption "Make formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
description = "make formatter to use";
type = listOf (enum (attrNames formats));
default = defaultFormat;
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Make diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Make";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
};
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft.make = cfg.format.type;
formatters =
mapListToAttrs (name: {
inherit name;
value = formats.${name};
})
cfg.format.type;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.make = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -39,6 +39,7 @@ in {
getOpts = keymap: {
inherit (keymap) desc silent nowait script expr unique noremap;
remap = !keymap.noremap;
};
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";