Compare commits

..

No commits in common. "0c650e0801aebbfc2817c11140c90768c178b13b" and "99bf160aaef28d47f1818deffe662ce1c4d6e6a1" have entirely different histories.

2 changed files with 17 additions and 33 deletions

View file

@ -208,8 +208,4 @@ https://github.com/gorbit99/codewindow.nvim
- Changed `withRuby` to not be enabled by default - Changed `withRuby` to not be enabled by default
[horriblename](https://github.com/horriblename):
- Ignore terminals by default in spell-checking
<!-- vim: set textwidth=80: --> <!-- vim: set textwidth=80: -->

View file

@ -4,14 +4,13 @@
lib, lib,
... ...
}: let }: let
inherit (builtins) length;
inherit (lib.modules) mkIf mkRenamedOptionModule; inherit (lib.modules) mkIf mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.strings) concatLines concatStringsSep; inherit (lib.strings) concatLines concatStringsSep optionalString;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.types) listOf str attrsOf bool; inherit (lib.types) listOf str attrsOf;
inherit (lib.lists) optional; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.spellcheck; cfg = config.vim.spellcheck;
in { in {
@ -87,12 +86,6 @@ in {
''; '';
}; };
ignoreTerminal = mkOption {
type = bool;
default = true;
description = "Disable spell checking in terminal.";
};
programmingWordlist.enable = mkEnableOption '' programmingWordlist.enable = mkEnableOption ''
vim-dirtytalk, a wordlist for programmers containing vim-dirtytalk, a wordlist for programmers containing
common programming terms. common programming terms.
@ -151,25 +144,20 @@ in {
spelllang = concatStringsSep "," cfg.languages; spelllang = concatStringsSep "," cfg.languages;
}; };
augroups = [{name = "nvf_spellcheck";}]; # Register an autocommand to disable spellchecking in buffers with given filetypes.
autocmds = # If the list is empty, the autocommand does not need to be registered.
(optional cfg.ignoreTerminal { luaConfigRC.spellcheck = entryAfter ["basic"] (optionalString (cfg.ignoredFiletypes != []) ''
event = ["TermOpen"]; -- Disable spellchecking for certain filetypes
group = "nvf_spellcheck"; -- as configured by `vim.spellcheck.ignoredFiletypes`
callback = mkLuaInline '' vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})
function() vim.opt_local.spell = false end vim.api.nvim_create_autocmd({ "FileType" }, {
''; group = "nvf_autocmds",
}) pattern = ${toLuaObject cfg.ignoredFiletypes},
++ (optional (length cfg.ignoredFiletypes > 0) { callback = function()
event = ["FileType"];
group = "nvf_spellcheck";
pattern = cfg.ignoredFiletypes;
callback = mkLuaInline ''
function()
vim.opt_local.spell = false vim.opt_local.spell = false
end end,
''; })
}); '');
}; };
}; };
} }