Skip to content

Commit

Permalink
Merge pull request #546 from NotAShelf/diniamo-moment
Browse files Browse the repository at this point in the history
various: address diniamo's review comments
  • Loading branch information
NotAShelf authored Jan 10, 2025
2 parents 9c8fbc7 + 4aa183d commit 4df1cc3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ isMaximal: {
};

spellcheck = {
enable = isMaximal;
enable = true;
};

lsp = {
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/rl-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ configuration formats.

### `vim.maps` rewrite {#sec-vim-maps-rewrite}

Instead of specifying map modes using submodules (e.g.: `vim.maps.normal`), a
Instead of specifying map modes using submodules (e.g., `vim.maps.normal`), a
new `vim.keymaps` submodule with support for a `mode` option has been
introduced. It can be either a string, or a list of strings, where a string
represents the short-name of the map mode(s), that the mapping should be set
Expand Down
7 changes: 0 additions & 7 deletions lib/languages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
inherit (lib.types) bool;
inherit (lib.nvim.attrsets) mapListToAttrs;
in {
# Converts a boolean to a yes/no string. This is used in lots of
# configuration formats, and is not covered by `toLuaObject`
toVimBool = bool:
if bool
then "yes"
else "no";

diagnosticsToLua = {
lang,
config,
Expand Down
15 changes: 11 additions & 4 deletions modules/neovim/init/spellcheck.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}: let
inherit (lib.modules) mkIf mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.strings) concatLines;
inherit (lib.strings) concatLines concatStringsSep optionalString;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.types) listOf str attrsOf;
inherit (lib.nvim.lua) listToLuaTable;
Expand Down Expand Up @@ -134,10 +134,17 @@ in {

options = {
spell = true;
spelllang = cfg.languages;

# Workaround for Neovim's spelllang setup. It can be
# - a string, e.g., "en"
# - multiple strings, separated with commas, e.g., "en,de"
# toLuaObject cannot generate the correct type here, unless we take a string here.
spelllang = concatStringsSep "," cfg.languages;
};

luaConfigRC.spellcheck = entryAfter ["basic"] ''
# 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})
Expand All @@ -148,7 +155,7 @@ in {
vim.opt_local.spell = false
end,
})
'';
'');
};
};
}
17 changes: 6 additions & 11 deletions modules/wrapper/rc/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
inherit (lib.options) mkOption literalMD literalExpression;
inherit (lib.strings) optionalString;
inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything;
inherit (lib.trivial) isBool;
inherit (lib.nvim.languages) toVimBool;
inherit (lib.nvim.types) dagOf;
inherit (lib.nvim.lua) listToLuaTable;

Expand Down Expand Up @@ -238,13 +236,10 @@ in {
};

signcolumn = mkOption {
type = either str bool;
default = true;
apply = x:
if isBool x
then toVimBool x # convert to a yes/no str
else x;
description = "Show the sign column";
type = str;
default = "yes";
example = "no";
description = "Whether to show the sign column";
};

tabstop = mkOption {
Expand Down Expand Up @@ -313,7 +308,7 @@ in {
if [](#opt-vim.enableLuaLoader) is set to true.
'';

example = literalExpression ''''${builtins.readFile ./my-lua-config-pre.lua}'';
example = literalExpression "\${builtins.readFile ./my-lua-config-pre.lua}";

description = ''
Verbatim lua code that will be inserted **before**
Expand Down Expand Up @@ -357,7 +352,7 @@ in {
luaConfigPost = mkOption {
type = str;
default = "";
example = literalExpression ''"$${builtins.readFile ./my-lua-config-post.lua}"'';
example = literalExpression "\${builtins.readFile ./my-lua-config-post.lua}";
description = ''
Verbatim lua code that will be inserted **after**
the result of the `luaConfigRc` DAG has been resolved
Expand Down

0 comments on commit 4df1cc3

Please sign in to comment.