modules/neovim: rename vim.spellChecking to vim.spellcheck

more consistent this way
This commit is contained in:
NotAShelf 2024-04-20 19:00:20 +03:00
parent 5c7fd22c1d
commit 4d8dcc7e49
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
3 changed files with 14 additions and 10 deletions

View file

@ -3,25 +3,29 @@
lib, lib,
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD; inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) listOf str; inherit (lib.types) listOf str;
inherit (lib.nvim.lua) listToLuaTable; inherit (lib.nvim.lua) listToLuaTable;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.spellChecking; cfg = config.vim.spellcheck;
in { in {
options.vim.spellChecking = { imports = [
(mkRenamedOptionModule ["vim" "spellChecking"] ["vim" "spellcheck"])
];
options.vim.spellcheck = {
enable = mkEnableOption "neovim's built-in spellchecking"; enable = mkEnableOption "neovim's built-in spellchecking";
languages = mkOption { languages = mkOption {
type = listOf str; type = listOf str;
default = ["en"]; default = ["en"];
example = literalExpression ''["en" "de"]''; example = literalExpression ''["en" "de"]'';
description = literalMD '' description = ''
A list of languages that should be used for spellchecking. A list of languages that should be used for spellchecking.
To add your own language files, you may place your `spell` To add your own language files, you may place your `spell`
directory in either {path}`~/.config/nvim` or the directory in either `~/.config/nvim` or the
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths) [additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
directory provided by neovim-flake. directory provided by neovim-flake.
''; '';
@ -49,12 +53,12 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.luaConfigRC.spellchecking = entryAfter ["basic"] '' vim.luaConfigRC.spellcheck = entryAfter ["basic"] ''
vim.opt.spell = true vim.opt.spell = true
vim.opt.spelllang = ${listToLuaTable cfg.languages} vim.opt.spelllang = ${listToLuaTable cfg.languages}
-- Disable spellchecking for certain filetypes -- Disable spellchecking for certain filetypes
-- as configured by `vim.spellChecking.ignoredFiletypes` -- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_autocmd({ "FileType" }, { vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = ${listToLuaTable cfg.ignoredFiletypes}, pattern = ${listToLuaTable cfg.ignoredFiletypes},
callback = function() callback = function()

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.spellChecking; cfg = config.vim.spellcheck;
in { in {
config = mkIf (cfg.enable && cfg.programmingWordlist.enable) { config = mkIf (cfg.enable && cfg.programmingWordlist.enable) {
vim = { vim = {

View file

@ -2,6 +2,6 @@
inherit (lib.modules) mkAliasOptionModule; inherit (lib.modules) mkAliasOptionModule;
in { in {
imports = [ imports = [
(mkAliasOptionModule ["vim" "spellcheck" "vim-dirtytalk" "enable"] ["vim" "spellChecking" "programmingWordlist" "enable"]) (mkAliasOptionModule ["vim" "spellcheck" "vim-dirtytalk" "enable"] ["vim" "spellcheck" "programmingWordlist" "enable"])
]; ];
} }