From 981707410ef69a4f53cc8cf720171cf58e2c59ab Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 2 Feb 2026 14:25:11 +0100 Subject: [PATCH 1/2] spellcheck: disable in terminal --- modules/neovim/init/spellcheck.nix | 46 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/modules/neovim/init/spellcheck.nix b/modules/neovim/init/spellcheck.nix index 724b432d..6fe41183 100644 --- a/modules/neovim/init/spellcheck.nix +++ b/modules/neovim/init/spellcheck.nix @@ -4,13 +4,14 @@ lib, ... }: let + inherit (builtins) length; inherit (lib.modules) mkIf mkRenamedOptionModule; inherit (lib.options) mkOption mkEnableOption literalExpression; - inherit (lib.strings) concatLines concatStringsSep optionalString; + inherit (lib.strings) concatLines concatStringsSep; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.types) listOf str attrsOf; - inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.dag) entryAfter; + inherit (lib.types) listOf str attrsOf bool; + inherit (lib.lists) optional; + inherit (lib.generators) mkLuaInline; cfg = config.vim.spellcheck; in { @@ -86,6 +87,12 @@ in { ''; }; + ignoreTerminal = mkOption { + type = bool; + default = true; + description = "Disable spell checking in terminal."; + }; + programmingWordlist.enable = mkEnableOption '' vim-dirtytalk, a wordlist for programmers containing common programming terms. @@ -144,20 +151,25 @@ in { spelllang = concatStringsSep "," cfg.languages; }; - # Register an autocommand to disable spellchecking in buffers with given filetypes. - # If the list is empty, the autocommand does not need to be registered. - luaConfigRC.spellcheck = entryAfter ["basic"] (optionalString (cfg.ignoredFiletypes != []) '' - -- Disable spellchecking for certain filetypes - -- as configured by `vim.spellcheck.ignoredFiletypes` - vim.api.nvim_create_augroup("nvf_autocmds", {clear = false}) - vim.api.nvim_create_autocmd({ "FileType" }, { - group = "nvf_autocmds", - pattern = ${toLuaObject cfg.ignoredFiletypes}, - callback = function() - vim.opt_local.spell = false - end, + augroups = [{name = "nvf_spellcheck";}]; + autocmds = + (optional cfg.ignoreTerminal { + event = ["TermOpen"]; + group = "nvf_spellcheck"; + callback = mkLuaInline '' + function() vim.opt_local.spell = false end + ''; }) - ''); + ++ (optional (length cfg.ignoredFiletypes > 0) { + event = ["FileType"]; + group = "nvf_spellcheck"; + pattern = cfg.ignoredFiletypes; + callback = mkLuaInline '' + function() + vim.opt_local.spell = false + end + ''; + }); }; }; } From 2c677a8b5ccdd0872ec75014ba7135842053eafb Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Tue, 3 Feb 2026 15:44:31 +0100 Subject: [PATCH 2/2] docs: update release notes --- docs/manual/release-notes/rl-0.9.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 662f7aeb..f6b3c05f 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -178,4 +178,8 @@ https://github.com/gorbit99/codewindow.nvim - Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and `setupOpts` +[horriblename](https://github.com/horriblename): + +- Ignore terminals by default in spell-checking +